Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/portals-pluto
diff --git a/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java b/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
index 8aec848..1b6ea6a 100644
--- a/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
+++ b/maven-pluto-plugin/src/main/java/org/apache/pluto/maven/InstallationDependency.java
@@ -54,6 +54,10 @@
         new InstallationDependency("org.jboss.weld.servlet", "weld-servlet", 
                 VERSION_PROPERTIES.getProperty("cdi.version"));
 
+    public static final InstallationDependency ANNOTATION_DETECTOR =
+        new InstallationDependency("eu.infomas", "annotation-detector", 
+                VERSION_PROPERTIES.getProperty("annotation-detector.version"));
+
     public static final InstallationDependency SLF4J_API =
         new InstallationDependency("org.slf4j", "slf4j-api", 
                 VERSION_PROPERTIES.getProperty("slf4j.version"));
@@ -150,6 +154,7 @@
         SHARED.add(TAGLIB);
         SHARED.add(CCPP_API);
         SHARED.add(CDI_IMPL);
+        SHARED.add(ANNOTATION_DETECTOR);
         SHARED.add(SLF4J_API);
         SHARED.add(SLF4J_IMPL);
     }
diff --git a/maven-pluto-plugin/src/main/resources/versions.properties b/maven-pluto-plugin/src/main/resources/versions.properties
index 7175c33..c45a5c0 100644
--- a/maven-pluto-plugin/src/main/resources/versions.properties
+++ b/maven-pluto-plugin/src/main/resources/versions.properties
@@ -23,6 +23,7 @@
 servlet-api.version=${servlet-api.version}

 jsp-api.version=${jsp-api.version}

 cdi.version=${cdi.version}

+annotation-detector.version=${annotation-detector.version}

 slf4j.version=${slf4j.version}

 jstl.version=${jstl.version}

 taglibs.standard.version=${taglibs.standard.version}

diff --git a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
index 9100208..7a0a82e 100644
--- a/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
+++ b/pluto-container-driver-api/src/main/java/org/apache/pluto/container/driver/PortletContainerInitializer.java
@@ -38,10 +38,6 @@
 import javax.servlet.annotation.HandlesTypes;

 

 import org.apache.pluto.container.PortletInvokerService;

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

-import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

-import org.apache.pluto.container.bean.processor.ConfigSummary;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.om.portlet.PortletDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

 import org.slf4j.Logger;

@@ -79,20 +75,11 @@
 

       try {

 

-         // Get the bean configuration from the CDI extension

-

+         

+         // scan for method annotations

+         

          ConfigurationHolder holder = new ConfigurationHolder();

-         AnnotatedConfigBean acb = PortletCDIExtension.getConfig();

-         if (acb == null) {

-            holder.setMethodStore(new AnnotatedMethodStore(new ConfigSummary()));

-            if (isDebug) {

-               StringBuilder txt = new StringBuilder();

-               txt.append("CDI not available. Created new method store.");

-               LOG.debug(txt.toString());

-            }

-         } else {

-            holder.setMethodStore(acb.getMethodStore());

-         }

+         holder.scanMethodAnnotations(ctx);

 

          // Read the annotated configuration

 

@@ -171,14 +158,14 @@
             

             // Add the cross-context filter & terminal listener

             

-            FilterRegistration.Dynamic fr = ctx.addFilter("WeldCrossContextFilter", "org.jboss.weld.servlet.WeldCrossContextFilter");

-            EnumSet<DispatcherType> dt = EnumSet.noneOf(DispatcherType.class);

-            dt.add(DispatcherType.FORWARD);

-            dt.add(DispatcherType.INCLUDE);

-            dt.add(DispatcherType.ERROR);

-            fr.addMappingForUrlPatterns(dt, false, "/*");

-            

-            ctx.addListener("org.jboss.weld.servlet.WeldTerminalListener");

+//             FilterRegistration.Dynamic fr = ctx.addFilter("WeldCrossContextFilter", "org.jboss.weld.servlet.WeldCrossContextFilter");

+//             EnumSet<DispatcherType> dt = EnumSet.noneOf(DispatcherType.class);

+//             dt.add(DispatcherType.FORWARD);

+//             dt.add(DispatcherType.INCLUDE);

+//             dt.add(DispatcherType.ERROR);

+//             fr.addMappingForUrlPatterns(dt, false, "/*");

+//             

+//             ctx.addListener("org.jboss.weld.servlet.WeldTerminalListener");

 

             LOG.debug("Completed deployment of servlets & filters for context: " + ctx.getContextPath());

 

diff --git a/pluto-container/pom.xml b/pluto-container/pom.xml
index ed41612..d74fb2f 100644
--- a/pluto-container/pom.xml
+++ b/pluto-container/pom.xml
@@ -40,6 +40,12 @@
          <scope>provided</scope>

       </dependency>

 

+      <!-- For method annotation scanning ==================================== -->

+      <dependency>

+         <groupId>eu.infomas</groupId>

+         <artifactId>annotation-detector</artifactId>

+      </dependency>

+

       <!-- Specification Libraries =========================================== -->

       <dependency>

          <groupId>org.apache.portals.pluto</groupId>

@@ -61,6 +67,13 @@
          <scope>provided</scope>

       </dependency>

 

+      <!-- CDI API for extension -->

+      <dependency>

+         <groupId>javax.enterprise</groupId>

+         <artifactId>cdi-api</artifactId>

+         <version>1.2</version>

+      </dependency>

+

       <!-- Testing Libraries ================================================= -->

       <dependency>

          <groupId>org.slf4j</groupId>

diff --git a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/AnnotationRecognizer.java b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/AnnotationRecognizer.java
index 57b344b..0739a44 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/AnnotationRecognizer.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/AnnotationRecognizer.java
@@ -113,8 +113,6 @@
             }

          }

          

-         checkForMethodAnnotations(aType.getJavaClass());

-         

       } catch (Exception e) {

          

          // The rest of the possible exceptions are unexpected, so someone will

diff --git a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/MethodAnnotationRecognizer.java b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/MethodAnnotationRecognizer.java
new file mode 100644
index 0000000..41e16af
--- /dev/null
+++ b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/MethodAnnotationRecognizer.java
@@ -0,0 +1,244 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one

+ *  or more contributor license agreements.  See the NOTICE file

+ *  distributed with this work for additional information

+ *  regarding copyright ownership.  The ASF licenses this file

+ *  to you under the Apache License, Version 2.0 (the

+ *  "License"); you may not use this file except in compliance

+ *  with the License.  You may obtain a copy of the License at

+ *

+ *    http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing,

+ *  software distributed under the License is distributed on an

+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+ *  KIND, either express or implied.  See the License for the

+ *  specific language governing permissions and limitations

+ *  under the License.

+ */

+

+package org.apache.pluto.container.bean.processor;

+

+import java.io.File;

+import java.io.IOException;

+import java.io.PrintWriter;

+import java.io.StringWriter;

+import java.lang.annotation.Annotation;

+import java.net.URL;

+import java.util.HashSet;

+import java.util.Set;

+

+import javax.portlet.annotations.ActionMethod;

+import javax.portlet.annotations.EventMethod;

+import javax.portlet.annotations.HeaderMethod;

+import javax.portlet.annotations.RenderMethod;

+import javax.portlet.annotations.ServeResourceMethod;

+import javax.servlet.ServletContext;

+

+import org.slf4j.Logger;

+import org.slf4j.LoggerFactory;

+

+import eu.infomas.annotation.AnnotationDetector;

+

+/**

+ * Uses the annotation detector to find the portlet method annotations.

+ * 

+ * @author Scott Nicklous

+ * 

+ */

+public class MethodAnnotationRecognizer extends PortletAnnotationRecognizer implements AnnotationDetector.MethodReporter {

+   private static final Logger LOG = LoggerFactory.getLogger(MethodAnnotationRecognizer.class);

+   private static final boolean isDebug = LOG.isDebugEnabled();

+   

+   private static final String  CLASSDIR  = "/WEB-INF/classes";

+   private static final String  LIBDIR    = "/WEB-INF/lib";

+   

+   private AnnotationDetector ad;

+   private Set<String> handledClasses = new HashSet<String>();

+

+

+   public MethodAnnotationRecognizer(AnnotatedMethodStore pms, ConfigSummary summary) {

+      super(pms, summary);

+      ad = new AnnotationDetector(this);

+   }

+

+   /**

+    * Defines the annotation classes to be scanned for

+    */

+   @SuppressWarnings("unchecked")

+   @Override

+   public Class<? extends Annotation>[] annotations() {

+      return new Class[] { HeaderMethod.class, ActionMethod.class, EventMethod.class, RenderMethod.class,

+            ServeResourceMethod.class };

+   }

+

+   /**

+    * Callback when a target annotation is found. Reuses superclass functionality to

+    * register all portlet annotated methods in the class.

+    */

+   @Override

+   public void reportMethodAnnotation(Class<? extends Annotation> anno, String className, String methName) {

+      

+      if (!handledClasses.contains(className)) {

+         handledClasses.add(className);

+         

+         Class<?> valClass = null;

+         StringBuilder txt = new StringBuilder(128);

+         try {

+            ClassLoader cl = Thread.currentThread().getContextClassLoader();

+            if (cl == null) {

+               cl = this.getClass().getClassLoader();

+            }

+            valClass = cl.loadClass(className);

+         } catch (Exception e) {

+         }

+

+         if (isDebug) {

+            txt.append("Found: ").append(anno.getSimpleName());

+            txt.append(", class name: ").append(className);

+            txt.append(", method name: ").append(methName);

+            txt.append(", class: ").append((valClass == null) ? "could not be loaded." : "loaded.");

+            LOG.debug(txt.toString());

+         }

+

+         if (valClass != null) {

+            checkForMethodAnnotations(valClass);

+         }

+      }

+   }

+   

+   /**

+    * Scans the servlet context classes and libraries for portlet method

+    * annotations.

+    * 

+    * @param ctx     the servlet context

+    */

+   public void scanContext(ServletContext ctx) {

+      Set<File> files;

+      

+      files = getClassFilesForPath(ctx, CLASSDIR);

+      scanFiles(files);

+      

+      files = getLibFilesForPath(ctx, LIBDIR);

+      scanFiles(files);

+      

+      activateAnnotatedMethods(null);

+   }

+   

+   /**

+    * Scans the given set of files for annotations.

+    * 

+    * @param files   the files to scan

+    */

+   public void scanFiles(Set<File> files) {

+      

+      long start = System.currentTimeMillis();

+      try {

+         ad.detect(files.toArray(new File[0]));

+      } catch (IOException e) {

+         StringBuilder txt = new StringBuilder(128);

+         txt.append("Exception scanning for method annotations.");

+         

+         StringWriter sw = new StringWriter();

+         PrintWriter pw = new PrintWriter(sw);

+         e.printStackTrace(pw);

+         pw.flush();

+         txt.append(sw.toString());

+         

+         LOG.warn(txt.toString());

+      }

+      long delta = System.currentTimeMillis() - start;

+      

+      if (isDebug) {

+         StringBuilder txt = new StringBuilder();

+         txt.append("Scanned ").append(files.size()).append(" files.");

+         txt.append(" Time: ").append(delta).append(" ms.");

+         txt.append("Files: ");

+         String sep = "";

+         for (File file : files) {

+            txt.append(sep).append(file.toString());

+            sep = ", ";

+         }

+         LOG.debug(txt.toString());

+      }

+   }

+   

+

+   /**

+    * Generates a list of all class files available on a given servlet context 

+    * resource path.

+    * 

+    * @param ctx     the servlet context

+    * @param path    the resource path

+    * 

+    * @return        a set of class files

+    */

+   private Set<File> getClassFilesForPath(ServletContext ctx, String path) {

+      Set<File> files = new HashSet<File>();

+      Set<String> paths = ctx.getResourcePaths(path);

+      if (paths != null) {

+         for (String pth : paths) {

+            if (pth.endsWith("META-INF/")) {

+               continue;

+            } else if (pth.endsWith("/")) {

+               files.addAll(getClassFilesForPath(ctx, pth));

+            } else if (pth.endsWith(".class")) {

+               try {

+                  URL url = ctx.getResource(pth);

+                  File f = new File(url.toURI());

+                  files.add(f);

+               } catch(Exception e) {

+                  StringBuilder txt = new StringBuilder(128);

+                  txt.append("Exception getting library file.");

+

+                  StringWriter sw = new StringWriter();

+                  PrintWriter pw = new PrintWriter(sw);

+                  e.printStackTrace(pw);

+                  pw.flush();

+                  txt.append(sw.toString());

+

+                  LOG.warn(txt.toString());

+               }

+            }

+         }

+      }

+      return files;

+   }

+

+   /**

+    * Returns a set of all library files in the designated servlet context resource path.

+    * 

+    * @param ctx     the servlet context

+    * @param path    the resource path

+    * 

+    * @return        a set of class files

+    */

+   private Set<File> getLibFilesForPath(ServletContext ctx, String path) {

+      Set<File> files = new HashSet<File>();

+      Set<String> libs = ctx.getResourcePaths(path);

+      if (libs != null) {

+         for (String lib : libs) {

+            if (lib.endsWith(".jar")) {

+               try {

+                  URL url = ctx.getResource(lib);

+                  File f = new File(url.toURI());

+                  files.add(f);

+               } catch(Exception e) {

+                  StringBuilder txt = new StringBuilder(128);

+                  txt.append("Exception getting library file.");

+                  

+                  StringWriter sw = new StringWriter();

+                  PrintWriter pw = new PrintWriter(sw);

+                  e.printStackTrace(pw);

+                  pw.flush();

+                  txt.append(sw.toString());

+                  

+                  LOG.warn(txt.toString());

+               }

+            }

+         }

+      }

+      return files;

+   }

+

+

+}

diff --git a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletAnnotationRecognizer.java b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletAnnotationRecognizer.java
index 99e5da9..1eb52cc 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletAnnotationRecognizer.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/bean/processor/PortletAnnotationRecognizer.java
@@ -375,7 +375,7 @@
     * verify that the stored methods are consistent.

     */

    @Override

-   protected void activateAnnotatedMethods(BeanManager bm) {

+   public void activateAnnotatedMethods(BeanManager bm) {

       

       // Verify the portlet names in the proxied method store. It is an error if:

       // 1) There is no method for a given name, but configuration data exists

@@ -415,9 +415,6 @@
          }

       }

       

-      //TODO: remove ams initialization

-      ams.activateMethods(bm);

-      

    }

 

    /**

diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
index 0ec2f34..7fc6a75 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationHolder.java
@@ -18,6 +18,7 @@
 

 package org.apache.pluto.container.om.portlet.impl;

 

+import java.io.File;

 import java.io.IOException;

 import java.io.InputStream;

 import java.util.Set;

@@ -29,6 +30,7 @@
 import javax.portlet.annotations.PortletListener;

 import javax.portlet.annotations.PortletPreferencesValidator;

 import javax.portlet.annotations.PortletLifecycleFilter;

+import javax.servlet.ServletContext;

 import javax.xml.bind.JAXBContext;

 import javax.xml.bind.JAXBElement;

 import javax.xml.bind.JAXBException;

@@ -38,6 +40,8 @@
 import javax.xml.stream.XMLStreamReader;

 

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

+import org.apache.pluto.container.bean.processor.MethodAnnotationRecognizer;

 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.PortletDefinition;

 import org.slf4j.Logger;

@@ -64,7 +68,8 @@
                                                            + "org.apache.pluto.container.om.portlet20.impl:"

                                                            + "org.apache.pluto.container.om.portlet30.impl";

 

-   private AnnotatedMethodStore methodStore;

+   private ConfigSummary configSummary = new ConfigSummary();

+   private AnnotatedMethodStore methodStore = new AnnotatedMethodStore(configSummary);

    private boolean portletsInstantiated = false;

    

    /**

@@ -106,6 +111,20 @@
    }

 

    /**

+    * @return the configSummary

+    */

+   public ConfigSummary getConfigSummary() {

+      return configSummary;

+   }

+

+   /**

+    * @param configSummary the configSummary to set

+    */

+   public void setConfigSummary(ConfigSummary configSummary) {

+      this.configSummary = configSummary;

+   }

+

+   /**

     * Processes the portlet deployment descriptor represented by the given input stream.

     * <p>

     * The data is merged into an existing configuration data structure if one is provided. This capability is used by

@@ -306,5 +325,29 @@
       jcp.reconcileBeanConfig(ams);

       jcp.instantiatePortlets(ams, ams.getBeanMgr());

    }

+   

+   /**

+    * Scans servlet context for method annotations.

+    * 

+    * @param ctx  the servlet context

+    */

+   public void scanMethodAnnotations(ServletContext ctx) {

+      MethodAnnotationRecognizer mar = new MethodAnnotationRecognizer(methodStore, configSummary);

+      mar.scanContext(ctx);

+      LOG.debug("Scan complete: \n" + methodStore.getMethodsAsString());

+   }

+   

+   /**

+    * Scans list of files for method annotations.

+    * (unit test execution path)

+    * 

+    * @param files   the set of files to scan

+    */

+   public void scanMethodAnnotations(Set<File> files) {

+      MethodAnnotationRecognizer mar = new MethodAnnotationRecognizer(methodStore, configSummary);

+      mar.scanFiles(files);

+      mar.activateAnnotatedMethods(null);

+      LOG.debug("Scan complete: \n" + methodStore.getMethodsAsString());

+   }

 

 }

diff --git a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
index 2f3d75f..8b9f400 100644
--- a/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
+++ b/pluto-container/src/main/java/org/apache/pluto/container/om/portlet/impl/ConfigurationProcessor.java
@@ -16,6 +16,7 @@
 import java.lang.reflect.Method;

 import java.util.ArrayList;

 import java.util.Arrays;

+import java.util.HashSet;

 import java.util.List;

 import java.util.Locale;

 import java.util.Random;

@@ -619,7 +620,7 @@
       if (isDebug) {

          StringBuilder txt = new StringBuilder();

          txt.append("Instantiating the portlets.");

-         txt.append(" bean mgr = null: ").append(bm == null);

+         txt.append(" beanMgr: ").append((bm == null) ? "null" : "not null");

          txt.append(", portlet names: ").append(Arrays.toString(ams.getPortletNames().toArray()));

          LOG.debug(txt.toString());

       }

@@ -627,7 +628,9 @@
       ams.activateMethods(bm);

     

       for (PortletDefinition pd : pad.getPortlets()) {

+         Set<Class<?>> processedClasses = new HashSet<Class<?>>();

          String clsName = pd.getPortletClass();

+         Object instance = null;

          

          if (clsName != null) {

             ClassLoader cl = Thread.currentThread().getContextClassLoader();

@@ -636,7 +639,7 @@
             }

             try {

                Class<?> cls = cl.loadClass(clsName);

-               Object instance = null;

+               processedClasses.add(cls);

                

                // Let CDI instantiate the portlet to allow for injection. 

                // Get the single bean instance for the portlet class.

@@ -710,6 +713,35 @@
             }

 

          }

+         

+         if (bm == null) {

+            

+            // Running in an environment without CDI support, the portlet classes

+            // need to be instantiated in such a way that all methods of a given portlet and

+            // a given class use the same instance of that class. Also, annotated portlet

+            // methods can appear in classes that do not implement the Portlet interface

+            // and those classes need to be instantiated as well.

+            

+            for (MethodIdentifier mi : ams.getMethodIDsForPortlet(pd.getPortletName())) {

+               for (AnnotatedMethod am : ams.getMethods(mi)) {

+                  Class<?> cls = am.getBeanClass();

+                  if (!processedClasses.contains(cls)) {

+                     processedClasses.add(cls);

+                     try {

+                        instance = cls.newInstance();

+                        ams.setPortletClassInstance(pd.getPortletName(), cls, instance);

+                     } catch (Exception e) {

+                        StringBuilder txt = new StringBuilder(128);

+                        txt.append("Exception creating instance of class: ").append(e.toString());

+                        txt.append(" Portlet name: ").append(pd.getPortletName());

+                        txt.append(", portlet class: ").append(cls);

+                        LOG.warn(txt.toString());

+                     }

+                  }

+               }

+            }

+

+         }

       }

    }

    

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/InvocationResults.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/InvocationResults.java
index 5c2e24c..9c4b9a1 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/InvocationResults.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/InvocationResults.java
@@ -33,6 +33,21 @@
 

    private List<String> methods = new ArrayList<String>();

    boolean configExists = false;

+   

+   private static InvocationResults results;

+

+   /**

+    * singleton

+    */

+   private InvocationResults() {

+   }

+   

+   public static InvocationResults getInvocationResults() {

+      if (results == null) {

+         results = new InvocationResults();

+      }

+      return results;

+   }

 

    /**

     * @return the methods

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action1.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action1.java
index a0a03d9..35c0631 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action1.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action1.java
@@ -19,11 +19,13 @@
 

 package org.apache.pluto.container.bean.processor.fixtures.action;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.annotations.ActionMethod;

+import javax.portlet.annotations.EventDefinition;

+import javax.portlet.annotations.PortletApplication;

 import javax.portlet.annotations.PortletQName;

+import javax.portlet.annotations.RenderMethod;

 

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 

@@ -31,10 +33,19 @@
  * @author Scott Nicklous

  *

  */

+@PortletApplication(

+      defaultNamespaceURI="https://www.java.net/",

+      events = {

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="pub1")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="pub2")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="pub3")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="pub4")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="", localPart="event4"))

+      }

+      )

 public class Action1 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @ActionMethod(portletName="portlet1", 

          publishingEvents= {

@@ -49,5 +60,9 @@
       meths.addMethod(this.getClass().getSimpleName() + "#action2");

    }

    

+   // dummy render method to keep config processor happy

+   

+   @RenderMethod(portletNames= {"portlet1", "portlet2", "portlet3", "portlet6"})

+   public void render1() {}

 

 }

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action2.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action2.java
index 360a20c..f650022 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action2.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/action/Action2.java
@@ -19,7 +19,6 @@
 

 package org.apache.pluto.container.bean.processor.fixtures.action;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.annotations.ActionMethod;

@@ -33,8 +32,7 @@
  */

 public class Action2 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @ActionMethod(portletName="portlet3",

          publishingEvents= {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event1.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event1.java
index 1d90cff..95b40ec 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event1.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event1.java
@@ -19,11 +19,13 @@
 

 package org.apache.pluto.container.bean.processor.fixtures.event;

 

-import javax.inject.Inject;

 import javax.portlet.EventRequest;

 import javax.portlet.EventResponse;

+import javax.portlet.annotations.EventDefinition;

 import javax.portlet.annotations.EventMethod;

+import javax.portlet.annotations.PortletApplication;

 import javax.portlet.annotations.PortletQName;

+import javax.portlet.annotations.RenderMethod;

 

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 

@@ -31,10 +33,25 @@
  * @author Scott Nicklous

  *

  */

+@PortletApplication(

+      defaultNamespaceURI="https://www.java.net/",

+      events = {

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="pub1")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="pub2")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="pub3")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="https://www.java.net/", localPart="pub4")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="proc1")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="proc2")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="proc3a")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="proc3c")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="https://www.java.net/", localPart="proc3b")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="http://www.apache.org", localPart="proc6")),

+            @EventDefinition(qname=@PortletQName(namespaceURI="", localPart="event4"))

+      }

+      )

 public class Event1 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @EventMethod(portletName="portlet1", 

          processingEvents= {

@@ -55,5 +72,10 @@
       meths.addMethod(this.getClass().getSimpleName() + "#event2");

    }

    

+   // dummy render method to keep config processor happy

+   

+   @RenderMethod(portletNames= {"portlet1", "portlet2"})

+   public void render1() {}

+   

 

 }

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event2.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event2.java
index 88fe4f2..687cd00 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event2.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/event/Event2.java
@@ -19,11 +19,11 @@
 

 package org.apache.pluto.container.bean.processor.fixtures.event;

 

-import javax.inject.Inject;

 import javax.portlet.EventRequest;

 import javax.portlet.EventResponse;

 import javax.portlet.annotations.EventMethod;

 import javax.portlet.annotations.PortletQName;

+import javax.portlet.annotations.RenderMethod;

 

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 

@@ -33,8 +33,7 @@
  */

 public class Event2 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @EventMethod(portletName="portlet3",

          processingEvents= {

@@ -115,6 +114,11 @@
    public void event7(EventRequest req, EventResponse resp) {

       meths.addMethod(this.getClass().getSimpleName() + "#event7");

    }

+   

+   // dummy render method to keep config processor happy

+   

+   @RenderMethod(portletNames= {"portlet3", "portlet6"})

+   public void render1() {}

 

 

 }

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header1.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header1.java
index c5eff06..5f44fb4 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header1.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header1.java
@@ -19,7 +19,6 @@
 

 package org.apache.pluto.container.bean.processor.fixtures.header;

 

-import javax.inject.Inject;

 import javax.portlet.HeaderRequest;

 import javax.portlet.HeaderResponse;

 import javax.portlet.annotations.HeaderMethod;

@@ -32,8 +31,7 @@
  */

 public class Header1 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @HeaderMethod(portletNames="portlet1")

    public void header1a(HeaderRequest req, HeaderResponse resp) {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header2.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header2.java
index 0aee0ef..62255da 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header2.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/header/Header2.java
@@ -20,7 +20,6 @@
 package org.apache.pluto.container.bean.processor.fixtures.header;

 

 import javax.activity.InvalidActivityException;

-import javax.inject.Inject;

 import javax.portlet.HeaderRequest;

 import javax.portlet.HeaderResponse;

 import javax.portlet.annotations.HeaderMethod;

@@ -33,8 +32,7 @@
  */

 public class Header2 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @HeaderMethod(portletNames="portlet2", portletMode="edit", ordinal=-100)

    public void header2c(HeaderRequest req, HeaderResponse resp) {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render1.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render1.java
index 857d3c1..9b92566 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render1.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render1.java
@@ -19,7 +19,6 @@
 

 package org.apache.pluto.container.bean.processor.fixtures.render;

 

-import javax.inject.Inject;

 import javax.portlet.RenderRequest;

 import javax.portlet.RenderResponse;

 import javax.portlet.annotations.RenderMethod;

@@ -32,8 +31,7 @@
  */

 public class Render1 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @RenderMethod(portletNames="portlet1")

    public void render1a(RenderRequest req, RenderResponse resp) {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render2.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render2.java
index 031af11..e34cd19 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render2.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/render/Render2.java
@@ -20,7 +20,6 @@
 package org.apache.pluto.container.bean.processor.fixtures.render;

 

 import javax.activity.InvalidActivityException;

-import javax.inject.Inject;

 import javax.portlet.RenderRequest;

 import javax.portlet.RenderResponse;

 import javax.portlet.annotations.RenderMethod;

@@ -33,8 +32,7 @@
  */

 public class Render2 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @RenderMethod(portletNames="portlet2", portletMode="edit", ordinal=-100)

    public void render2c(RenderRequest req, RenderResponse resp) {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource1.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource1.java
index 4d44be3..b31d05c 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource1.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource1.java
@@ -19,7 +19,6 @@
 

 package org.apache.pluto.container.bean.processor.fixtures.resource;

 

-import javax.inject.Inject;

 import javax.portlet.ResourceRequest;

 import javax.portlet.ResourceResponse;

 import javax.portlet.annotations.ServeResourceMethod;

@@ -32,8 +31,7 @@
  */

 public class Resource1 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @ServeResourceMethod(portletNames="portlet1")

    public void resource1a(ResourceRequest req, ResourceResponse resp) {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource2.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource2.java
index 4ff9811..aa51b08 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource2.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/fixtures/resource/Resource2.java
@@ -20,7 +20,6 @@
 package org.apache.pluto.container.bean.processor.fixtures.resource;

 

 import javax.activity.InvalidActivityException;

-import javax.inject.Inject;

 import javax.portlet.ResourceRequest;

 import javax.portlet.ResourceResponse;

 import javax.portlet.annotations.ServeResourceMethod;

@@ -33,8 +32,7 @@
  */

 public class Resource2 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @ServeResourceMethod(portletNames="portlet2", resourceID="edit", ordinal=-100)

    public void resource2c(ResourceRequest req, ResourceResponse resp) {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ActionTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ActionTest.java
index 98d35b5..6ae69dc 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ActionTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ActionTest.java
@@ -16,36 +16,34 @@
  *  under the License.

  */

 

-

 package org.apache.pluto.container.bean.processor.tests;

 

 import static org.apache.pluto.container.bean.processor.MethodType.ACTION;

+import static org.apache.pluto.container.bean.processor.MethodType.RENDER;

 import static org.junit.Assert.assertEquals;

 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

 import java.lang.reflect.Method;

+import java.net.URISyntaxException;

 import java.util.Arrays;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethod;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.MethodIdentifier;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.MethodType;

 import org.apache.pluto.container.bean.processor.fixtures.action.Action1;

 import org.apache.pluto.container.bean.processor.fixtures.action.Action2;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for action method annotations.

@@ -53,27 +51,25 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Action1.class)

 public class ActionTest {

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

-   

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

-      

+

+   private static final String         pkg     = "org.apache.pluto.container.bean.processor.fixtures.action";

+

+   private static AnnotatedMethodStore ams     = null;

+   private static ConfigSummary        summary = null;

+   private static ConfigurationHolder  holder  = new ConfigurationHolder();

+

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+

       assertNotNull(ams);

       assertNotNull(summary);

    }

-   

+

    @Test

    public void portletNamesTest() throws Exception {

       Set<String> names = ams.getPortletNames();

@@ -84,7 +80,7 @@
       assertTrue(names.contains("portlet3"));

       assertTrue(names.contains("portlet6"));

    }

-   

+

    @Test

    public void errorDuplicateMethod() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -92,7 +88,7 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet2"));

    }

-   

+

    @Test

    public void errorDuplicateMethod2() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -100,7 +96,7 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet6"));

    }

-   

+

    @Test

    public void errorBadReturnType() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -108,7 +104,7 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet5"));

    }

-   

+

    @Test

    public void errorBadParameters() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -116,42 +112,49 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet4"));

    }

-   

+

    @Test

    public void methods1Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet1");

       assertNotNull(portlets);

-      assertEquals(1, portlets.size());

+      assertEquals(2, portlets.size());

       MethodIdentifier mi = (MethodIdentifier) portlets.toArray()[0];

-      assertEquals(ACTION, mi.getType());

+      if (!mi.getType().equals(ACTION)) {

+         mi = (MethodIdentifier) portlets.toArray()[1];

+      }

       assertEquals("", mi.getId());

       assertEquals("portlet1", mi.getName());

    }

-   

+

    @Test

    public void methods2Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet2");

       assertNotNull(portlets);

-      assertEquals(1, portlets.size());

+      assertEquals(2, portlets.size());

       MethodIdentifier mi = (MethodIdentifier) portlets.toArray()[0];

-      assertEquals(ACTION, mi.getType());

+      List<MethodType> types = Arrays.asList(ACTION, RENDER);

+      assertTrue(types.contains(mi.getType()));

+      if (!mi.getType().equals(ACTION)) {

+         mi = (MethodIdentifier) portlets.toArray()[1];

+      }

       assertEquals("", mi.getId());

       assertEquals("portlet2", mi.getName());

    }

-   

+

    @Test

    public void methods3Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet3");

       assertNotNull(portlets);

-      assertEquals(3, portlets.size());

-      List<String> ids = Arrays.asList(new String[] {"", "Fred", "Barney"});

+      assertEquals(4, portlets.size());

+      List<String> ids = Arrays.asList(new String[] { "", "Fred", "Barney" });

       for (MethodIdentifier mi : portlets) {

-         assertEquals(ACTION, mi.getType());

-         assertTrue(ids.contains(mi.getId()));

-         assertEquals("portlet3", mi.getName());

+         if (mi.getType().equals(ACTION)) {

+            assertTrue(ids.contains(mi.getId()));

+            assertEquals("portlet3", mi.getName());

+         }

       }

    }

-   

+

    @Test

    public void class1Test() throws Exception {

       MethodIdentifier mi = new MethodIdentifier("portlet1", "", ACTION);

@@ -162,7 +165,7 @@
       assertEquals("action1", m.getName());

       assertEquals(Action1.class, m.getDeclaringClass());

    }

-   

+

    @Test

    public void class2Test() throws Exception {

       MethodIdentifier mi = new MethodIdentifier("portlet2", "", ACTION);

@@ -172,10 +175,10 @@
       assertNotNull(m);

       assertEquals("action2", m.getName());

       // don't know which one the scanner will find first

-      List<Class<?>> list = Arrays.asList(new Class<?>[] {Action1.class, Action2.class});

+      List<Class<?>> list = Arrays.asList(new Class<?>[] { Action1.class, Action2.class });

       assertTrue(list.contains(m.getDeclaringClass()));

    }

-   

+

    @Test

    public void class3Test() throws Exception {

       MethodIdentifier mi = new MethodIdentifier("portlet3", "", ACTION);

@@ -186,7 +189,7 @@
       assertEquals("action1a", m.getName());

       assertEquals(Action2.class, m.getDeclaringClass());

    }

-   

+

    @Test

    public void class4Test() throws Exception {

       MethodIdentifier mi = new MethodIdentifier("portlet3", "Fred", ACTION);

@@ -197,7 +200,7 @@
       assertEquals("action1b", m.getName());

       assertEquals(Action2.class, m.getDeclaringClass());

    }

-   

+

    @Test

    public void class5Test() throws Exception {

       MethodIdentifier mi = new MethodIdentifier("portlet3", "Barney", ACTION);

@@ -208,7 +211,7 @@
       assertEquals("action1c", m.getName());

       assertEquals(Action2.class, m.getDeclaringClass());

    }

-   

+

    @Test

    public void class6Test() throws Exception {

       MethodIdentifier mi = new MethodIdentifier("portlet6", "Wilma", ACTION);

@@ -216,10 +219,11 @@
       assertNotNull(am);

       Method m = am.getJavaMethod();

       assertNotNull(m);

-      assertEquals("action6", m.getName());

+      List<String> names = Arrays.asList("action6", "action7");

+      assertTrue(names.contains(m.getName()));

       assertEquals(Action2.class, m.getDeclaringClass());

    }

-   

+

    @Test

    public void pubEvent1Test() throws Exception {

       List<QName> qns = ams.getPublishingEventRefs("portlet1");

@@ -227,7 +231,7 @@
       assertEquals(1, qns.size());

       assertTrue(qns.contains(new QName("http://www.apache.org", "pub1")));

    }

-   

+

    @Test

    public void pubEvent2Test() throws Exception {

       List<QName> qns = ams.getPublishingEventRefs("portlet3");

@@ -238,5 +242,5 @@
       assertTrue(qns.contains(new QName("http://www.apache.org", "pub3")));

       assertTrue(qns.contains(new QName("http://www.apache.org", "pub4")));

    }

-   

+

 }

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventFixupTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventFixupTest.java
index 55b1831..959ad50 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventFixupTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventFixupTest.java
@@ -16,7 +16,6 @@
  *  under the License.

  */

 

-

 package org.apache.pluto.container.bean.processor.tests;

 

 import static org.apache.pluto.container.bean.processor.MethodType.EVENT;

@@ -24,28 +23,25 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

 import java.lang.reflect.Method;

+import java.net.URISyntaxException;

 import java.util.Arrays;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethod;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.MethodIdentifier;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.fixtures.event.Event1;

 import org.apache.pluto.container.bean.processor.fixtures.event.Event2;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for RenderStateScoped beans

@@ -53,30 +49,29 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Event1.class)

 public class EventFixupTest {

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

-   

-   private static String DEFAULT_NS = "http://www.java.net/";

-   

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

-      

+

+   private static String               DEFAULT_NS = "http://www.java.net/";

+

+   private static final String         pkg        = "org.apache.pluto.container.bean.processor.fixtures.event";

+

+   private static AnnotatedMethodStore ams        = null;

+   private static ConfigSummary        summary    = null;

+   private static ConfigurationHolder  holder     = new ConfigurationHolder();

+

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+

       assertNotNull(ams);

       assertNotNull(summary);

+

       ams.setDefaultNamespace(DEFAULT_NS);

    }

-   

+

    @Test

    public void portletNamesTest() throws Exception {

       Set<String> names = ams.getPortletNames();

@@ -87,7 +82,7 @@
       assertTrue(names.contains("portlet3"));

       assertTrue(names.contains("portlet6"));

    }

-   

+

    @Test

    public void errorDuplicateMethod() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -95,7 +90,7 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet2"));

    }

-   

+

    @Test

    public void errorDuplicateMethod2() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -103,7 +98,7 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet6"));

    }

-   

+

    @Test

    public void errorBadReturnType() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -111,7 +106,7 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet5"));

    }

-   

+

    @Test

    public void errorBadParameters() throws Exception {

       List<String> names = summary.getPortletsWithErrors();

@@ -119,48 +114,51 @@
       assertEquals(4, names.size());

       assertTrue(names.contains("portlet4"));

    }

-   

+

    @Test

    public void methods1Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet1");

       assertNotNull(portlets);

-      assertEquals(1, portlets.size());

+      assertEquals(2, portlets.size());

       MethodIdentifier mi = (MethodIdentifier) portlets.toArray()[0];

-      assertEquals(EVENT, mi.getType());

+      if (!mi.getType().equals(EVENT)) {

+         mi = (MethodIdentifier) portlets.toArray()[1];

+      }

       QName qn = new QName("http://www.apache.org", "proc1");

       assertEquals(qn, mi.getId());

       assertEquals("portlet1", mi.getName());

    }

-   

+

    @Test

    public void methods2Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet2");

       assertNotNull(portlets);

-      assertEquals(1, portlets.size());

+      assertEquals(2, portlets.size());

       MethodIdentifier mi = (MethodIdentifier) portlets.toArray()[0];

-      assertEquals(EVENT, mi.getType());

+      if (!mi.getType().equals(EVENT)) {

+         mi = (MethodIdentifier) portlets.toArray()[1];

+      }

       QName qn = new QName("http://www.apache.org", "proc2");

       assertEquals(qn, mi.getId());

       assertEquals("portlet2", mi.getName());

    }

-   

+

    @Test

    public void methods3Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet3");

       assertNotNull(portlets);

-      assertEquals(3, portlets.size());

-      List<QName> ids = Arrays.asList(new QName[] {

-            new QName("http://www.apache.org", "proc3a"),

-            new QName(DEFAULT_NS, "proc3b"),

-            new QName("http://www.apache.org", "proc3c"),

-      });

+      assertEquals(4, portlets.size());

+      List<QName> ids = Arrays.asList(new QName[] { new QName("http://www.apache.org", "proc3a"),

+            new QName(DEFAULT_NS, "proc3b"), new QName("http://www.apache.org", "proc3c"), });

       for (MethodIdentifier mi : portlets) {

-         assertEquals(EVENT, mi.getType());

-         assertTrue(ids.contains(mi.getId()));

-         assertEquals("portlet3", mi.getName());

+         if (mi.getType().equals(EVENT)) {

+            assertEquals(EVENT, mi.getType());

+            assertTrue(ids.contains(mi.getId()));

+            assertEquals("portlet3", mi.getName());

+         }

       }

    }

-   

+

    @Test

    public void class1Test() throws Exception {

       QName qn = new QName("http://www.apache.org", "proc1");

@@ -175,7 +173,7 @@
       assertEquals("event1", m.getName());

       assertEquals(Event1.class, m.getDeclaringClass());

    }

-   

+

    @Test

    public void class2Test() throws Exception {

       QName qn = new QName("http://www.apache.org", "proc2");

@@ -189,10 +187,10 @@
       assertNotNull(m);

       assertEquals("event2", m.getName());

       // don't know which one the scanner will find first

-      List<Class<?>> clslst = Arrays.asList(new Class<?>[] {Event1.class, Event2.class});

+      List<Class<?>> clslst = Arrays.asList(new Class<?>[] { Event1.class, Event2.class });

       assertTrue(clslst.contains(m.getDeclaringClass()));

    }

-   

+

    @Test

    public void class6Test() throws Exception {

       QName qn = new QName("http://www.apache.org", "proc6");

@@ -205,27 +203,30 @@
       Method m = am.getJavaMethod();

       assertNotNull(m);

       // order in which method found undefined

-      List<String> names = Arrays.asList(new String[] {"event6", "event7"});

+      List<String> names = Arrays.asList(new String[] { "event6", "event7" });

       assertTrue(names.contains(m.getName()));

       assertEquals(Event2.class, m.getDeclaringClass());

    }

-   

+

    @Test

    public void class4Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet3");

       assertNotNull(portlets);

-      assertEquals(3, portlets.size());

+      assertEquals(4, portlets.size());

 

-      List<String> methNames = Arrays.asList(new String[] {"event1a", "event1b", "event1c"});

+      List<String> methNames = Arrays.asList(new String[] { "event1a", "event1b", "event1c", "render1" });

       for (MethodIdentifier mi : portlets) {

-         AnnotatedMethod am = ams.getMethod(mi);

+         List<AnnotatedMethod> meths = ams.getMethods(mi); 

+         assertEquals(1, meths.size());

+         AnnotatedMethod am = meths.get(0);

+         assertNotNull(am);

          Method m = am.getJavaMethod();

          assertNotNull(m);

          assertTrue(methNames.contains(m.getName()));

          assertEquals(Event2.class, m.getDeclaringClass());

       }

    }

-   

+

    @Test

    public void pubEvent1Test() throws Exception {

       List<QName> qns = ams.getPublishingEventRefs("portlet1");

@@ -233,7 +234,7 @@
       assertEquals(1, qns.size());

       assertTrue(qns.contains(new QName("http://www.apache.org", "pub1")));

    }

-   

+

    @Test

    public void pubEvent2Test() throws Exception {

       List<QName> qns = ams.getPublishingEventRefs("portlet3");

@@ -244,7 +245,7 @@
       assertTrue(qns.contains(new QName("http://www.apache.org", "pub3")));

       assertTrue(qns.contains(new QName(DEFAULT_NS, "pub4")));

    }

-   

+

    @Test

    public void procEvent1Test() throws Exception {

       List<QName> qns = ams.getProcessingEventRefs("portlet1");

@@ -252,7 +253,7 @@
       assertEquals(1, qns.size());

       assertTrue(qns.contains(new QName("http://www.apache.org", "proc1")));

    }

-   

+

    @Test

    public void procEvent2Test() throws Exception {

       List<QName> qns = ams.getProcessingEventRefs("portlet2");

@@ -260,7 +261,7 @@
       assertEquals(1, qns.size());

       assertTrue(qns.contains(new QName("http://www.apache.org", "proc2")));

    }

-   

+

    @Test

    public void procEvent3Test() throws Exception {

       List<QName> qns = ams.getProcessingEventRefs("portlet3");

@@ -270,7 +271,7 @@
       assertTrue(qns.contains(new QName(DEFAULT_NS, "proc3b")));

       assertTrue(qns.contains(new QName("http://www.apache.org", "proc3c")));

    }

-   

+

    @Test

    public void procEvent6Test() throws Exception {

       List<QName> qns = ams.getProcessingEventRefs("portlet6");

@@ -278,5 +279,5 @@
       assertEquals(1, qns.size());

       assertTrue(qns.contains(new QName("http://www.apache.org", "proc6")));

    }

-   

+

 }

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventTest.java
index 5e516bc..f8faee1 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/EventTest.java
@@ -24,29 +24,26 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

 import java.lang.reflect.Method;

+import java.net.URISyntaxException;

 import java.util.Arrays;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.XMLConstants;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethod;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.MethodIdentifier;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.fixtures.event.Event1;

 import org.apache.pluto.container.bean.processor.fixtures.event.Event2;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for event method annotations

@@ -54,25 +51,25 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Event1.class)

 public class EventTest {

    

-   @Inject

-   AnnotatedConfigBean acb;

    

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.event";

    

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+   

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

       

       assertNotNull(ams);

       assertNotNull(summary);

+

    }

    

    @Test

@@ -122,8 +119,11 @@
    public void methods1Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet1");

       assertNotNull(portlets);

-      assertEquals(1, portlets.size());

+      assertEquals(2, portlets.size());

       MethodIdentifier mi = (MethodIdentifier) portlets.toArray()[0];

+      if (!mi.getType().equals(EVENT)) {

+         mi = (MethodIdentifier) portlets.toArray()[1];

+      }

       assertEquals(EVENT, mi.getType());

       QName qn = new QName("http://www.apache.org", "proc1");

       assertEquals(qn, mi.getId());

@@ -134,8 +134,11 @@
    public void methods2Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet2");

       assertNotNull(portlets);

-      assertEquals(1, portlets.size());

+      assertEquals(2, portlets.size());

       MethodIdentifier mi = (MethodIdentifier) portlets.toArray()[0];

+      if (!mi.getType().equals(EVENT)) {

+         mi = (MethodIdentifier) portlets.toArray()[1];

+      }

       assertEquals(EVENT, mi.getType());

       QName qn = new QName("http://www.apache.org", "proc2");

       assertEquals(qn, mi.getId());

@@ -146,16 +149,17 @@
    public void methods3Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet3");

       assertNotNull(portlets);

-      assertEquals(3, portlets.size());

+      assertEquals(4, portlets.size());

       List<QName> ids = Arrays.asList(new QName[] {

             new QName("http://www.apache.org", "proc3a"),

             new QName(XMLConstants.NULL_NS_URI, "proc3b"),

             new QName("http://www.apache.org", "proc3c"),

       });

       for (MethodIdentifier mi : portlets) {

-         assertEquals(EVENT, mi.getType());

-         assertTrue(ids.contains(mi.getId()));

-         assertEquals("portlet3", mi.getName());

+         if (mi.getType().equals(EVENT)) {

+            assertTrue(ids.contains(mi.getId()));

+            assertEquals("portlet3", mi.getName());

+         }

       }

    }

    

@@ -212,11 +216,13 @@
    public void class4Test() throws Exception {

       Set<MethodIdentifier> portlets = ams.getMethodIDsForPortlet("portlet3");

       assertNotNull(portlets);

-      assertEquals(3, portlets.size());

+      assertEquals(4, portlets.size());

 

-      List<String> methNames = Arrays.asList(new String[] {"event1a", "event1b", "event1c"});

+      List<String> methNames = Arrays.asList(new String[] {"event1a", "event1b", "event1c", "render1"});

       for (MethodIdentifier mi : portlets) {

-         AnnotatedMethod am = ams.getMethod(mi);

+         List<AnnotatedMethod> meths = ams.getMethods(mi); 

+         assertEquals(1, meths.size());

+         AnnotatedMethod am = meths.get(0);

          Method m = am.getJavaMethod();

          assertNotNull(m);

          assertTrue(methNames.contains(m.getName()));

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/FileHelper.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/FileHelper.java
new file mode 100644
index 0000000..87259da
--- /dev/null
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/FileHelper.java
@@ -0,0 +1,67 @@
+/*  Licensed to the Apache Software Foundation (ASF) under one

+ *  or more contributor license agreements.  See the NOTICE file

+ *  distributed with this work for additional information

+ *  regarding copyright ownership.  The ASF licenses this file

+ *  to you under the Apache License, Version 2.0 (the

+ *  "License"); you may not use this file except in compliance

+ *  with the License.  You may obtain a copy of the License at

+ *

+ *    http://www.apache.org/licenses/LICENSE-2.0

+ *

+ *  Unless required by applicable law or agreed to in writing,

+ *  software distributed under the License is distributed on an

+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

+ *  KIND, either express or implied.  See the License for the

+ *  specific language governing permissions and limitations

+ *  under the License.

+ */

+

+

+package org.apache.pluto.container.bean.processor.tests;

+

+import java.io.File;

+import java.io.IOException;

+import java.net.URISyntaxException;

+import java.net.URL;

+import java.util.Collections;

+import java.util.HashSet;

+import java.util.List;

+import java.util.Set;

+

+/**

+ * Methods to help handle class files.

+ * 

+ * @author Scott Nicklous

+ *

+ */

+public class FileHelper {

+

+   /**

+    * Returns a set of all class files for given package.

+    * 

+    * @param pkg        the package

+    * @return           set of classes

+    * @throws URISyntaxException

+    * @throws IOException

+    */

+   public static Set<File> getClasses(String pkg) throws URISyntaxException, IOException {

+      Set<File> classes = new HashSet<File>();

+

+      ClassLoader cl = Thread.currentThread().getContextClassLoader();

+      

+      List<URL> urls = Collections.list(cl.getResources(pkg.replaceAll("\\.", "/")));

+      for (URL url : urls) {

+         File dir = new File(url.toURI());

+         if (dir.isDirectory()) {

+            for (File file : dir.listFiles()) {

+               if (file.isFile() && file.getAbsolutePath().endsWith(".class")) {

+                  classes.add(file);

+               }

+            }

+         }

+      }

+

+      return classes;

+   }

+

+}

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/HeaderTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/HeaderTest.java
index 2368521..4d84855 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/HeaderTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/HeaderTest.java
@@ -19,34 +19,31 @@
 package org.apache.pluto.container.bean.processor.tests;

 

 import static org.apache.pluto.container.bean.processor.MethodType.HEADER;

-import static org.junit.Assert.assertEquals;

 import static org.junit.Assert.assertArrayEquals;

+import static org.junit.Assert.assertEquals;

 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

 import java.lang.reflect.Method;

+import java.net.URISyntaxException;

 import java.util.ArrayList;

 import java.util.Arrays;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethod;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.MethodIdentifier;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.fixtures.header.Header1;

 import org.apache.pluto.container.bean.processor.fixtures.header.Header2;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for header method annotations

@@ -54,23 +51,23 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Header1.class)

 public class HeaderTest {

-

-   @Inject

-   AnnotatedConfigBean          acb;

-

-   private AnnotatedMethodStore ams     = null;

-   private ConfigSummary        summary = null;

-

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

-

+   

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.header";

+   

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+   

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      

       assertNotNull(ams);

       assertNotNull(summary);

    }

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeActionTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeActionTest.java
index 66f1c1b..8805d3f 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeActionTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeActionTest.java
@@ -23,27 +23,25 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

+import java.net.URISyntaxException;

 import java.util.Arrays;

+import java.util.HashSet;

 import java.util.List;

+import java.util.Set;

 

-import javax.inject.Inject;

-

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.PortletInvoker;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 import org.apache.pluto.container.bean.processor.fixtures.action.Action1;

 import org.apache.pluto.container.bean.processor.fixtures.action.Action2;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockActionRequest;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockActionResponse;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for invoking the annotated action methods.

@@ -51,28 +49,30 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Action1.class)

 public class InvokeActionTest {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private static MockActionRequest req = new MockActionRequest();

    private static MockActionResponse resp = new MockActionResponse();

    

-   @Inject

-   AnnotatedConfigBean acb;

+   private static final Set<Class<?>> annotatedClasses =

+         new HashSet<Class<?>>(Arrays.asList(Action1.class)); 

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.action";

    

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

    

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.processConfigAnnotations(annotatedClasses);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

       

       assertNotNull(ams);

       assertNotNull(summary);

@@ -81,7 +81,7 @@
    @Test

    public void invoke1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       req.setActionName(null);

       i.processAction(req, resp);

       List<String> names = meths.getMethods();

@@ -93,7 +93,7 @@
    @Test

    public void invoke2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       req.setActionName(null);

       i.processAction(req, resp);

       List<String> names = meths.getMethods();

@@ -110,7 +110,7 @@
    @Test

    public void invoke3a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       req.setActionName("");

       i.processAction(req, resp);

       List<String> names = meths.getMethods();

@@ -122,7 +122,7 @@
    @Test

    public void invoke3b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       req.setActionName("Fred");

       i.processAction(req, resp);

       List<String> names = meths.getMethods();

@@ -134,7 +134,7 @@
    @Test

    public void invoke3c() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       req.setActionName("Barney");

       i.processAction(req, resp);

       List<String> names = meths.getMethods();

@@ -146,7 +146,7 @@
    @Test

    public void invoke6() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       req.setActionName("Wilma");

       i.processAction(req, resp);

       List<String> names = meths.getMethods();

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeEventTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeEventTest.java
index bea9920..88f9be1 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeEventTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeEventTest.java
@@ -23,28 +23,27 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

+import java.net.URISyntaxException;

 import java.util.Arrays;

+import java.util.HashSet;

 import java.util.List;

+import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.PortletInvoker;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 import org.apache.pluto.container.bean.processor.fixtures.event.Event1;

 import org.apache.pluto.container.bean.processor.fixtures.event.Event2;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockEventRequest;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockEventResponse;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for invoking the annotated event methods.

@@ -52,40 +51,40 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Event1.class)

 public class InvokeEventTest {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private static final MockEventRequest req = new MockEventRequest();

    private static final MockEventResponse resp = new MockEventResponse();

+   private static String DEFAULT_NS = "https://www.java.net/";

    

-   @Inject

-   AnnotatedConfigBean acb;

+   private static final Set<Class<?>> annotatedClasses =

+         new HashSet<Class<?>>(Arrays.asList(Event1.class)); 

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.event";

    

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

    

-   private static String DEFAULT_NS = "http://www.java.net/";

-   

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.processConfigAnnotations(annotatedClasses);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

       

       assertNotNull(ams);

       assertNotNull(summary);

-      ams.setDefaultNamespace(DEFAULT_NS);

    }

    

    @Test

    public void invoke1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       QName qn = new QName("http://www.apache.org", "proc1");

       req.setQn(qn);

       i.processEvent(req, resp);

@@ -98,7 +97,7 @@
    @Test

    public void invoke2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       QName qn = new QName("http://www.apache.org", "proc2");

       req.setQn(qn);

       i.processEvent(req, resp);

@@ -116,7 +115,7 @@
    @Test

    public void invoke3a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       QName qn = new QName("http://www.apache.org", "proc3a");

       req.setQn(qn);

       i.processEvent(req, resp);

@@ -129,7 +128,7 @@
    @Test

    public void invoke3b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       QName qn = new QName(DEFAULT_NS, "proc3b");

       req.setQn(qn);

       i.processEvent(req, resp);

@@ -142,7 +141,7 @@
    @Test

    public void invoke3c() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       QName qn = new QName("http://www.apache.org", "proc3c");

       req.setQn(qn);

       i.processEvent(req, resp);

@@ -155,7 +154,7 @@
    @Test

    public void invoke6() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       QName qn = new QName("http://www.apache.org", "proc6");

       req.setQn(qn);

       i.processEvent(req, resp);

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeHeaderTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeHeaderTest.java
index adac9e4..c48ebd5 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeHeaderTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeHeaderTest.java
@@ -24,28 +24,26 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

+import java.net.URISyntaxException;

 import java.util.Arrays;

 import java.util.List;

+import java.util.Set;

 

-import javax.inject.Inject;

 import javax.portlet.PortletMode;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.PortletInvoker;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 import org.apache.pluto.container.bean.processor.fixtures.header.Header1;

 import org.apache.pluto.container.bean.processor.fixtures.header.Header2;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockHeaderRequest;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockHeaderResponse;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for invoking the annotated header methods.

@@ -53,40 +51,36 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Header1.class)

 public class InvokeHeaderTest {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private static final MockHeaderRequest req = new MockHeaderRequest();

    private static final MockHeaderResponse resp = new MockHeaderResponse();

    

-   @Inject

-   AnnotatedConfigBean acb;

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.header";

    

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

    

-   private static String DEFAULT_NS = "http://www.java.net/";

-   

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

       

       assertNotNull(ams);

       assertNotNull(summary);

-      ams.setDefaultNamespace(DEFAULT_NS);

    }

    

    @Test

    public void invoke1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -106,7 +100,7 @@
    @Test

    public void invoke1a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -126,7 +120,7 @@
    @Test

    public void invoke1b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = new PortletMode("CustomMode");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -146,7 +140,7 @@
    @Test

    public void invoke2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -158,7 +152,7 @@
    @Test

    public void invoke2a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -176,7 +170,7 @@
    @Test

    public void invoke2b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = new PortletMode("Config");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -194,7 +188,7 @@
    @Test

    public void invoke2c() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = PortletMode.EDIT;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -212,7 +206,7 @@
    @Test

    public void invoke3a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -228,7 +222,7 @@
    @Test

    public void invoke3b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -246,7 +240,7 @@
    @Test

    public void invoke6() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -262,7 +256,7 @@
    @Test

    public void invoke6a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -278,7 +272,7 @@
    @Test

    public void invoke7() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet7");

+      PortletInvoker i = new PortletInvoker(ams, "portlet7");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -294,7 +288,7 @@
    @Test

    public void invokeAdmin1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -310,7 +304,7 @@
    @Test

    public void invokeAdmin2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -326,7 +320,7 @@
    @Test

    public void invokeAdmin3() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -342,7 +336,7 @@
    @Test

    public void invokeAdmin4() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet4");

+      PortletInvoker i = new PortletInvoker(ams, "portlet4");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -354,7 +348,7 @@
    @Test

    public void invokeAdmin5() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet5");

+      PortletInvoker i = new PortletInvoker(ams, "portlet5");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -366,7 +360,7 @@
    @Test

    public void invokeAdmin8() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet8");

+      PortletInvoker i = new PortletInvoker(ams, "portlet8");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.renderHeaders(req, resp);

@@ -378,7 +372,7 @@
    @Test

    public void invokeAdmin7() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet7");

+      PortletInvoker i = new PortletInvoker(ams, "portlet7");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.renderHeaders(req, resp);

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeRenderTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeRenderTest.java
index ca91592..d5043f8 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeRenderTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeRenderTest.java
@@ -24,28 +24,26 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

+import java.net.URISyntaxException;

 import java.util.Arrays;

 import java.util.List;

+import java.util.Set;

 

-import javax.inject.Inject;

 import javax.portlet.PortletMode;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.PortletInvoker;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

-import org.apache.pluto.container.bean.processor.fixtures.render.Render1;

-import org.apache.pluto.container.bean.processor.fixtures.render.Render2;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockRenderRequest;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockRenderResponse;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.bean.processor.fixtures.render.Render1;

+import org.apache.pluto.container.bean.processor.fixtures.render.Render2;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for invoking the annotated render methods.

@@ -53,40 +51,36 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Render1.class)

 public class InvokeRenderTest {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private static final MockRenderRequest req = new MockRenderRequest();

    private static final MockRenderResponse resp = new MockRenderResponse();

    

-   @Inject

-   AnnotatedConfigBean acb;

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.render";

    

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

    

-   private static String DEFAULT_NS = "http://www.java.net/";

-   

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

       

       assertNotNull(ams);

       assertNotNull(summary);

-      ams.setDefaultNamespace(DEFAULT_NS);

    }

    

    @Test

    public void invoke1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.render(req, resp);

@@ -106,7 +100,7 @@
    @Test

    public void invoke1a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.render(req, resp);

@@ -118,7 +112,7 @@
    @Test

    public void invoke1b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = new PortletMode("CustomMode");

       req.setMode(mode);

       i.render(req, resp);

@@ -130,7 +124,7 @@
    @Test

    public void invoke2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.render(req, resp);

@@ -142,7 +136,7 @@
    @Test

    public void invoke2a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.render(req, resp);

@@ -160,7 +154,7 @@
    @Test

    public void invoke2b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = new PortletMode("Config");

       req.setMode(mode);

       i.render(req, resp);

@@ -178,7 +172,7 @@
    @Test

    public void invoke2c() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = PortletMode.EDIT;

       req.setMode(mode);

       i.render(req, resp);

@@ -196,7 +190,7 @@
    @Test

    public void invoke3a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.render(req, resp);

@@ -212,7 +206,7 @@
    @Test

    public void invoke3b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.render(req, resp);

@@ -230,7 +224,7 @@
    @Test

    public void invoke3c() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       PortletMode mode = PortletMode.EDIT;

       req.setMode(mode);

       i.render(req, resp);

@@ -246,7 +240,7 @@
    @Test

    public void invoke6() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       PortletMode mode = PortletMode.VIEW;

       req.setMode(mode);

       i.render(req, resp);

@@ -262,7 +256,7 @@
    @Test

    public void invoke6a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.render(req, resp);

@@ -273,7 +267,7 @@
    @Test

    public void invoke7() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet7");

+      PortletInvoker i = new PortletInvoker(ams, "portlet7");

       PortletMode mode = PortletMode.HELP;

       req.setMode(mode);

       i.render(req, resp);

@@ -285,7 +279,7 @@
    @Test

    public void invokeAdmin1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.render(req, resp);

@@ -301,7 +295,7 @@
    @Test

    public void invokeAdmin2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.render(req, resp);

@@ -317,7 +311,7 @@
    @Test

    public void invokeAdmin3() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.render(req, resp);

@@ -333,7 +327,7 @@
    @Test

    public void invokeAdmin4() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet4");

+      PortletInvoker i = new PortletInvoker(ams, "portlet4");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.render(req, resp);

@@ -345,7 +339,7 @@
    @Test

    public void invokeAdmin5() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet5");

+      PortletInvoker i = new PortletInvoker(ams, "portlet5");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.render(req, resp);

@@ -357,7 +351,7 @@
    @Test

    public void invokeAdmin8() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet8");

+      PortletInvoker i = new PortletInvoker(ams, "portlet8");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.render(req, resp);

@@ -369,7 +363,7 @@
    @Test

    public void invokeAdmin7() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet7");

+      PortletInvoker i = new PortletInvoker(ams, "portlet7");

       PortletMode mode = new PortletMode("admin");

       req.setMode(mode);

       i.render(req, resp);

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeResourceTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeResourceTest.java
index 4eb6a29..275fb7a 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeResourceTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/InvokeResourceTest.java
@@ -24,27 +24,25 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

+import java.net.URISyntaxException;

 import java.util.Arrays;

 import java.util.List;

+import java.util.Set;

 

-import javax.inject.Inject;

-

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.PortletInvoker;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockResourceRequest;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockResourceResponse;

 import org.apache.pluto.container.bean.processor.fixtures.resource.Resource1;

 import org.apache.pluto.container.bean.processor.fixtures.resource.Resource2;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for invoking the annotated resource methods.

@@ -52,40 +50,39 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Resource1.class)

 public class InvokeResourceTest {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private static final MockResourceRequest req = new MockResourceRequest();

    private static final MockResourceResponse resp = new MockResourceResponse();

    

-   @Inject

-   AnnotatedConfigBean acb;

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.resource";

    

-   private AnnotatedMethodStore ams = null;

-   private ConfigSummary summary = null;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+   private static PortletApplicationDefinition pad = null;

    

-   private static String DEFAULT_NS = "http://www.java.net/";

-   

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      pad = holder.getPad();

       

       assertNotNull(ams);

       assertNotNull(summary);

-      ams.setDefaultNamespace(DEFAULT_NS);

+      assertNotNull(pad);

    }

    

    @Test

    public void invoke1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       String resid = "VIEW";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -105,7 +102,7 @@
    @Test

    public void invoke1a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       String resid = "HELP";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -125,7 +122,7 @@
    @Test

    public void invoke1b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       String resid = "CustomMode";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -145,7 +142,7 @@
    @Test

    public void invoke2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       String resid = "VIEW";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -157,7 +154,7 @@
    @Test

    public void invoke2a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       String resid = "help";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -175,7 +172,7 @@
    @Test

    public void invoke2b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       String resid = "config";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -193,7 +190,7 @@
    @Test

    public void invoke2c() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       String resid = "edit";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -211,7 +208,7 @@
    @Test

    public void invoke2d() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       // resource ID match is case-sensitive

       String resid = "eDit";

       req.setResourceId(resid);

@@ -224,7 +221,7 @@
    @Test

    public void invoke3a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       String resid = "help";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -240,7 +237,7 @@
    @Test

    public void invoke3b() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       String resid = "VIEW";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -258,7 +255,7 @@
    @Test

    public void invoke6() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       String resid = "VIEW";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -274,7 +271,7 @@
    @Test

    public void invoke6a() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet6");

+      PortletInvoker i = new PortletInvoker(ams, "portlet6");

       String resid = "HELP";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -290,7 +287,7 @@
    @Test

    public void invoke7() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet7");

+      PortletInvoker i = new PortletInvoker(ams, "portlet7");

       String resid = "HELP";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -306,7 +303,7 @@
    @Test

    public void invokeAdmin1() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet1");

+      PortletInvoker i = new PortletInvoker(ams, "portlet1");

       String resid = "admin";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -322,7 +319,7 @@
    @Test

    public void invokeAdmin2() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet2");

+      PortletInvoker i = new PortletInvoker(ams, "portlet2");

       String resid = "admin";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -338,7 +335,7 @@
    @Test

    public void invokeAdmin3() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet3");

+      PortletInvoker i = new PortletInvoker(ams, "portlet3");

       String resid = "admin";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -354,7 +351,7 @@
    @Test

    public void invokeAdmin4() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet4");

+      PortletInvoker i = new PortletInvoker(ams, "portlet4");

       String resid = "admin";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -366,7 +363,7 @@
    @Test

    public void invokeAdmin5() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet5");

+      PortletInvoker i = new PortletInvoker(ams, "portlet5");

       String resid = "admin";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -378,7 +375,7 @@
    @Test

    public void invokeAdmin8() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet8");

+      PortletInvoker i = new PortletInvoker(ams, "portlet8");

       String resid = "admin";

       req.setResourceId(resid);

       i.serveResource(req, resp);

@@ -390,7 +387,7 @@
    @Test

    public void invokeAdmin7() throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, "portlet7");

+      PortletInvoker i = new PortletInvoker(ams, "portlet7");

       String resid = "admin";

       req.setResourceId(resid);

       i.serveResource(req, resp);

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/RenderTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/RenderTest.java
index f085a1e..f9d264b 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/RenderTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/RenderTest.java
@@ -19,34 +19,31 @@
 package org.apache.pluto.container.bean.processor.tests;

 

 import static org.apache.pluto.container.bean.processor.MethodType.RENDER;

-import static org.junit.Assert.assertEquals;

 import static org.junit.Assert.assertArrayEquals;

+import static org.junit.Assert.assertEquals;

 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

 import java.lang.reflect.Method;

+import java.net.URISyntaxException;

 import java.util.ArrayList;

 import java.util.Arrays;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethod;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.MethodIdentifier;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.fixtures.render.Render1;

 import org.apache.pluto.container.bean.processor.fixtures.render.Render2;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for RenderStateScoped beans

@@ -54,23 +51,23 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Render1.class)

 public class RenderTest {

-

-   @Inject

-   AnnotatedConfigBean          acb;

-

-   private AnnotatedMethodStore ams     = null;

-   private ConfigSummary        summary = null;

-

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

-

+   

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.render";

+   

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+   

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      

       assertNotNull(ams);

       assertNotNull(summary);

    }

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ResourceTest.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ResourceTest.java
index 8ff1be4..d64eb41 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ResourceTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/ResourceTest.java
@@ -19,34 +19,34 @@
 package org.apache.pluto.container.bean.processor.tests;

 

 import static org.apache.pluto.container.bean.processor.MethodType.RESOURCE;

-import static org.junit.Assert.*;

+import static org.junit.Assert.assertArrayEquals;

+import static org.junit.Assert.assertEquals;

+import static org.junit.Assert.assertFalse;

+import static org.junit.Assert.assertNotNull;

+import static org.junit.Assert.assertTrue;

 

+import java.io.File;

+import java.io.IOException;

 import java.lang.reflect.Method;

+import java.net.URISyntaxException;

 import java.util.ArrayList;

 import java.util.Arrays;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethod;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.MethodIdentifier;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

 import org.apache.pluto.container.bean.processor.fixtures.resource.Resource1;

 import org.apache.pluto.container.bean.processor.fixtures.resource.Resource2;

 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.PortletDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.AdditionalPackages;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

+import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Test class for RenderStateScoped beans

@@ -54,30 +54,27 @@
  * @author Scott Nicklous

  *

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses(PortletCDIExtension.class)

-@AdditionalPackages(Resource1.class)

 public class ResourceTest {

-

-   @Inject

-   AnnotatedConfigBean          acb;

-

-   private AnnotatedMethodStore ams     = null;

-   private ConfigSummary        summary = null;

-   private PortletApplicationDefinition pad = null;

-

-   @Before

-   public void setUp() {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      summary = acb.getSummary();

-

+   

+   private static final String pkg = "org.apache.pluto.container.bean.processor.fixtures.resource";

+   

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+   private static PortletApplicationDefinition pad = null;

+   

+   @BeforeClass

+   public static void setUpClass() throws URISyntaxException, IOException {

+      Set<File> classes = FileHelper.getClasses(pkg);

+      holder.scanMethodAnnotations(classes);

+      holder.reconcileBeanConfig();

+      holder.instantiatePortlets(null);

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      pad = holder.getPad();

+      

       assertNotNull(ams);

       assertNotNull(summary);

-      

-      ConfigurationHolder ch = new ConfigurationHolder();

-      ch.reconcileBeanConfig(ams);

-      pad = ch.getPad();

       assertNotNull(pad);

    }

 

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/WeldInitializer.java b/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/WeldInitializer.java
deleted file mode 100644
index ea544a3..0000000
--- a/pluto-container/src/test/java/org/apache/pluto/container/bean/processor/tests/WeldInitializer.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*  Licensed to the Apache Software Foundation (ASF) under one

- *  or more contributor license agreements.  See the NOTICE file

- *  distributed with this work for additional information

- *  regarding copyright ownership.  The ASF licenses this file

- *  to you under the Apache License, Version 2.0 (the

- *  "License"); you may not use this file except in compliance

- *  with the License.  You may obtain a copy of the License at

- *

- *    http://www.apache.org/licenses/LICENSE-2.0

- *

- *  Unless required by applicable law or agreed to in writing,

- *  software distributed under the License is distributed on an

- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY

- *  KIND, either express or implied.  See the License for the

- *  specific language governing permissions and limitations

- *  under the License.

- */

-

-

-package org.apache.pluto.container.bean.processor.tests;

-

-import org.jboss.weld.environment.se.Weld;

-import org.jboss.weld.environment.se.WeldContainer;

-

-/**

- * Class that doesn't do much except for initializing weld.

- * 

- * @author Scott Nicklous

- *

- */

-public class WeldInitializer {

-

-   // for Weld container initialization

-   public static Weld weld;

-   public static WeldContainer beanContainer;

-   static {

-      weld = new Weld();

-      beanContainer = weld.initialize();

-      System.out.println("SUI: static initializer - initialized Weld");

-   }

-

-}

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/IncompletePortlet.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/IncompletePortlet.java
index 0ac031d..3ed119f 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/IncompletePortlet.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/IncompletePortlet.java
@@ -42,8 +42,7 @@
 @ApplicationScoped

 public class IncompletePortlet {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private PortletConfig config;

    

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1.java
index 41c9346..166c39c 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1.java
@@ -21,7 +21,6 @@
 

 import java.io.IOException;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.EventRequest;

@@ -76,8 +75,7 @@
 })

 public class TestPortlet1 extends GenericPortlet {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

 

    @Override

    public void destroy() {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1a.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1a.java
index 3289ba1..d658100 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1a.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet1a.java
@@ -19,7 +19,6 @@
 

 package org.apache.pluto.container.reconcile.fixtures;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.EventRequest;

@@ -38,8 +37,7 @@
  */

 public class TestPortlet1a {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @ActionMethod(portletName="Portlet1", actionName="Fred", publishingEvents = {

          @PortletQName(namespaceURI="http://www.apache.org/", localPart="event2"),

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet2.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet2.java
index d569680..c40fb43 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet2.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet2.java
@@ -19,7 +19,6 @@
 

 package org.apache.pluto.container.reconcile.fixtures;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.EventRequest;

@@ -58,8 +57,7 @@
 )

 public class TestPortlet2 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    @RenderMethod(portletNames="Portlet2")

    public String myView() {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet3.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet3.java
index a3a4acc..7a9cc8c 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet3.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet3.java
@@ -21,7 +21,6 @@
 

 import java.io.IOException;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.Portlet;

@@ -38,8 +37,7 @@
  */

 public class TestPortlet3 implements Portlet {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private PortletConfig config;

 

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet4.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet4.java
index 08f0c0c..deb8570 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet4.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet4.java
@@ -20,7 +20,6 @@
 package org.apache.pluto.container.reconcile.fixtures;

 

 import javax.enterprise.context.ApplicationScoped;

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.EventRequest;

@@ -45,8 +44,7 @@
 @ApplicationScoped

 public class TestPortlet4 {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

    private PortletConfig config;

    

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet5.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet5.java
index 6877f72..234ef85 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet5.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet5.java
@@ -21,7 +21,6 @@
 

 import java.io.IOException;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.EventRequest;

@@ -77,8 +76,7 @@
 })

 public class TestPortlet5 extends GenericPortlet {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

 

    @Override

    public void destroy() {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet6.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet6.java
index 5eed2bd..7ee18de 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet6.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/fixtures/TestPortlet6.java
@@ -21,7 +21,6 @@
 

 import java.io.IOException;

 

-import javax.inject.Inject;

 import javax.portlet.ActionRequest;

 import javax.portlet.ActionResponse;

 import javax.portlet.EventRequest;

@@ -56,8 +55,7 @@
 @PortletConfiguration(portletName="Portlet6")

 public class TestPortlet6 extends GenericPortlet {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

 

    @Override

    public void init() {

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/AnnotatedGenericPortletInvokeTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/AnnotatedGenericPortletInvokeTest.java
index fd60857..b618866 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/AnnotatedGenericPortletInvokeTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/AnnotatedGenericPortletInvokeTest.java
@@ -25,51 +25,32 @@
 import java.util.HashSet;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.portlet.PortletMode;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

-import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

-import org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet5;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.CdiRunner;

 import org.junit.Before;

 import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Tests that if a generic portlet event method is annotated to provide the processing

- * event reference QNames, the methods are part of te same portlet instance.

+ * event reference QNames, the methods are part of the same portlet instance.

  * 

  * @author Scott Nicklous

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses({PortletCDIExtension.class, InvokeHelper.class, TestPortlet5.class})

 public class AnnotatedGenericPortletInvokeTest {

    

-   @Inject

-   private InvocationResults meths;

-   

-   @Inject

-   private InvokeHelper helper;

-

+   private InvocationResults meths = InvocationResults.getInvocationResults();

+   private static InvokeHelper helper;

    private static final Class<?> TEST_ANNOTATED_CLASS1 = TestPortlet5.class;

-

-   private static PortletApplicationDefinition pad;

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

-   // Classes under test

-   private AnnotatedMethodStore ams = null;

-   private PortletApplicationDefinition app;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

 

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

@@ -77,30 +58,28 @@
       Set<Class<?>> classes = new HashSet<Class<?>>();

       classes.add(TEST_ANNOTATED_CLASS1);

 

-      ConfigurationHolder ch = new ConfigurationHolder();

       try {

-         ch.processConfigAnnotations(classes);

+         holder.processConfigAnnotations(classes);

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

          try {

-            ch.validate();         // validate and ignore any validation problems.

+            holder.validate();         // validate and ignore any validation problems.

          } catch (Exception e) {}   

-         pad = ch.getPad();

       } catch (Exception e) {

          e.printStackTrace();

          throw e;

       }

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      

+      assertNotNull(ams);

+      assertNotNull(summary);

+      

+      helper = new InvokeHelper(ams);

    }

 

    @Before

    public void setUpBefore() throws Exception {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      assertNotNull(ams);

-      assertNotNull(helper);

-

-      app = new PortletApplicationDefinitionImpl(pad);

-      ConfigurationHolder coho = new ConfigurationHolder(app);

-      coho.reconcileBeanConfig(ams);

-      

       helper.init("Portlet5", null);

    }

   

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/GenericPortletFeaturesInvokeTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/GenericPortletFeaturesInvokeTest.java
index e211836..3be73eb 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/GenericPortletFeaturesInvokeTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/GenericPortletFeaturesInvokeTest.java
@@ -27,24 +27,17 @@
 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.portlet.PortletMode;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

-import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

-import org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet6;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.CdiRunner;

 import org.junit.Before;

 import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Tests that if a generic portlet event method is annotated to provide the processing

@@ -52,26 +45,14 @@
  * 

  * @author Scott Nicklous

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses({PortletCDIExtension.class, InvokeHelper.class, TestPortlet6.class})

 public class GenericPortletFeaturesInvokeTest {

    

-   @Inject

-   private InvocationResults meths;

-   

-   @Inject

-   private InvokeHelper helper;

-

+   private InvocationResults meths = InvocationResults.getInvocationResults();

+   private static InvokeHelper helper;

    private static final Class<?> TEST_ANNOTATED_CLASS1 = TestPortlet6.class;

-

-   private static PortletApplicationDefinition pad;

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

-   // Classes under test

-   private AnnotatedMethodStore ams = null;

-   private PortletApplicationDefinition app;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

 

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

@@ -79,30 +60,28 @@
       Set<Class<?>> classes = new HashSet<Class<?>>();

       classes.add(TEST_ANNOTATED_CLASS1);

 

-      ConfigurationHolder ch = new ConfigurationHolder();

       try {

-         ch.processConfigAnnotations(classes);

+         holder.processConfigAnnotations(classes);

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

          try {

-            ch.validate();         // validate and ignore any validation problems.

+            holder.validate();         // validate and ignore any validation problems.

          } catch (Exception e) {}   

-         pad = ch.getPad();

       } catch (Exception e) {

          e.printStackTrace();

          throw e;

       }

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      

+      assertNotNull(ams);

+      assertNotNull(summary);

+      

+      helper = new InvokeHelper(ams);

    }

 

    @Before

    public void setUpBefore() throws Exception {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      assertNotNull(ams);

-      assertNotNull(helper);

-

-      app = new PortletApplicationDefinitionImpl(pad);

-      ConfigurationHolder coho = new ConfigurationHolder(app);

-      coho.reconcileBeanConfig(ams);

-      

       helper.init("Portlet6", null);

    }

   

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ImpliedPortletTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ImpliedPortletTest.java
index 7b525ad..fe4f83c 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ImpliedPortletTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ImpliedPortletTest.java
@@ -19,96 +19,83 @@
 

 package org.apache.pluto.container.reconcile.tests;

 

-import static org.junit.Assert.*;

+import static org.junit.Assert.assertEquals;

+import static org.junit.Assert.assertNotNull;

+import static org.junit.Assert.assertNull;

+import static org.junit.Assert.assertTrue;

 

+import java.io.File;

 import java.io.InputStream;

 import java.util.HashSet;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

+import org.apache.pluto.container.bean.processor.tests.FileHelper;

 import org.apache.pluto.container.om.portlet.EventDefinitionReference;

 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.PortletDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

 import org.apache.pluto.container.om.portlet.impl.EventDefinitionReferenceImpl;

-import org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl;

-import org.apache.pluto.container.om.portlet.impl.jsr362.MergePortletAppTest;

-import org.apache.pluto.container.reconcile.fixtures.IncompletePortlet;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet1;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet2;

-import org.apache.pluto.container.reconcile.fixtures.TestPortlet3;

-import org.apache.pluto.container.reconcile.fixtures.TestPortlet4;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

 import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Adds a bean portlet that is defined implicitly through the portlet method annotations.

  * 

  * @author Scott Nicklous

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses({PortletCDIExtension.class, TestPortlet1.class, 

-   TestPortlet2.class, TestPortlet3.class, TestPortlet4.class, IncompletePortlet.class})

 public class ImpliedPortletTest {

 

    private static final Class<?> TEST_ANNOTATED_CLASS1 = TestPortlet1.class;

    private static final Class<?> TEST_ANNOTATED_CLASS2 = TestPortlet2.class;

    private static final String XML_FILE = 

          "org/apache/pluto/container/om/portlet/portlet362Reconcile.xml";

+   

+   private static final String pkg = "org.apache.pluto.container.reconcile.fixtures";

 

-   private static PortletApplicationDefinition pad;

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

-   private AnnotatedMethodStore ams = null;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

 

    // Classes under test

-   private PortletApplicationDefinition app;

+   private static PortletApplicationDefinition app;

 

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

+      Set<File> portletMethodClasses = FileHelper.getClasses(pkg);

       

-      InputStream in = MergePortletAppTest.class

+      InputStream in = ImpliedPortletTest.class

             .getClassLoader().getResourceAsStream(XML_FILE);

 

-      Set<Class<?>> classes = new HashSet<Class<?>>();

-      classes.add(TEST_ANNOTATED_CLASS1);

-      classes.add(TEST_ANNOTATED_CLASS2);

+      Set<Class<?>> configClasses = new HashSet<Class<?>>();

+      configClasses.add(TEST_ANNOTATED_CLASS1);

+      configClasses.add(TEST_ANNOTATED_CLASS2);

 

-      ConfigurationHolder ch = new ConfigurationHolder();

       try {

-         ch.processConfigAnnotations(classes);

-         ch.processPortletDD(in);     // process portlet xml after annotations

+         holder.scanMethodAnnotations(portletMethodClasses);

+         holder.processConfigAnnotations(configClasses);

+         holder.processPortletDD(in);     // process portlet xml after annotations

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

          try {

-            ch.validate();         // validate and ignore any validation problems.

+            holder.validate();         // validate and ignore any validation problems.

          } catch (Exception e) {}   

-         pad = ch.getPad();

       } catch (Exception e) {

          e.printStackTrace();

          throw e;

       }

-   }

-

-   @Before

-   public void setUpBefore() throws Exception {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      app = holder.getPad();

+      

       assertNotNull(ams);

-

-      app = new PortletApplicationDefinitionImpl(pad);

-      ConfigurationHolder coho = new ConfigurationHolder(app);

-      coho.reconcileBeanConfig(ams);

+      assertNotNull(summary);

    }

 

    // Begin portlet app tests ==================================

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/InvokeHelper.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/InvokeHelper.java
index fa77f54..9f0fc35 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/InvokeHelper.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/InvokeHelper.java
@@ -26,11 +26,10 @@
 

 import java.util.List;

 

-import javax.inject.Inject;

 import javax.portlet.PortletMode;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

+import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

 import org.apache.pluto.container.bean.processor.PortletInvoker;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

 import org.apache.pluto.container.bean.processor.fixtures.mocks.MockActionRequest;

@@ -53,11 +52,9 @@
  */

 public class InvokeHelper {

    

-   @Inject

-   private InvocationResults meths;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

    

-   @Inject

-   AnnotatedConfigBean acb;

+   private final AnnotatedMethodStore ams;

    

    private static MockPortletConfig config = new MockPortletConfig();

    

@@ -76,24 +73,27 @@
    private static MockResourceRequest  reqResource  = new MockResourceRequest();

    private static MockResourceResponse respResource = new MockResourceResponse();

 

+   public InvokeHelper(AnnotatedMethodStore ams) {

+      this.ams = ams;

+   }

    

    public void init(String portlet, String methName) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       i.init(config);

       checkName(methName);

    }

    

    public void destroy(String portlet, String methName) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       i.destroy();

       checkName(methName);

    }

    

    public void action(String portlet, String actName, String methName) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       reqAction.setActionName(actName);

       i.processAction(reqAction, respAction);

       checkName(methName);

@@ -101,7 +101,7 @@
    

    public void event(String portlet, QName qn, String methName) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       reqEvent.setQn(qn);

       i.processEvent(reqEvent, respEvent);

       checkName(methName);

@@ -109,7 +109,7 @@
    

    public void header(String portlet, PortletMode pm, String methName) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       reqHeader.setMode(pm);

       i.renderHeaders(reqHeader, respHeader);

       checkName(methName);

@@ -117,7 +117,7 @@
    

    public void render(String portlet, PortletMode pm, String methName) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       reqRender.setMode(pm);

       i.render(reqRender, respRender);

       checkName(methName);

@@ -126,7 +126,7 @@
    // used when a doHeaders call is expected (test portlet extends GenericPorlet)

    public void renderWithHeaders(String portlet, PortletMode pm, List<String> methNames) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       reqRender.setMode(pm);

       i.render(reqRender, respRender);

       List<String> names = meths.getMethods();

@@ -142,7 +142,7 @@
    

    public void resource(String portlet, String resid, String methName) throws Exception {

       meths.reset();

-      PortletInvoker i = new PortletInvoker(acb, portlet);

+      PortletInvoker i = new PortletInvoker(ams, portlet);

       reqResource.setResourceId(resid);

       i.serveResource(reqResource, respResource);

       checkName(methName);

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/MergeEventDefsTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/MergeEventDefsTest.java
index 0808400..df6ad46 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/MergeEventDefsTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/MergeEventDefsTest.java
@@ -23,6 +23,7 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertNull;

 

+import java.io.File;

 import java.io.InputStream;

 import java.util.HashSet;

 import java.util.List;

@@ -30,13 +31,15 @@
 

 import javax.xml.namespace.QName;

 

+import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

+import org.apache.pluto.container.bean.processor.tests.FileHelper;

 import org.apache.pluto.container.om.portlet.EventDefinitionReference;

 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.PortletDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

 import org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl;

 import org.apache.pluto.container.om.portlet.impl.PortletDefinitionImpl;

-import org.apache.pluto.container.om.portlet.impl.jsr362.MergePortletAppTest;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet1;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet2;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet3;

@@ -56,6 +59,12 @@
    private static final Class<?> TEST_ANNOTATED_CLASS2 = TestPortlet2.class;

    private static final String XML_FILE = 

          "org/apache/pluto/container/om/portlet/portlet362Reconcile.xml";

+   

+   private static final String pkg = "org.apache.pluto.container.reconcile.fixtures";

+

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

 

    private static PortletApplicationDefinition pad, app;

 

@@ -66,31 +75,39 @@
 

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

+      Set<File> portletMethodClasses = FileHelper.getClasses(pkg);

       

-      InputStream in = MergePortletAppTest.class

+      InputStream in = MergeEventDefsTest.class

             .getClassLoader().getResourceAsStream(XML_FILE);

 

-      Set<Class<?>> classes = new HashSet<Class<?>>();

-      classes.add(TEST_ANNOTATED_CLASS1);

-      classes.add(TEST_ANNOTATED_CLASS2);

+      Set<Class<?>> configClasses = new HashSet<Class<?>>();

+      configClasses.add(TEST_ANNOTATED_CLASS1);

+      configClasses.add(TEST_ANNOTATED_CLASS2);

 

-      ConfigurationHolder ch = new ConfigurationHolder();

       try {

-         ch.processConfigAnnotations(classes);

-         ch.processPortletDD(in);     // process portlet xml after annotations

+         holder.scanMethodAnnotations(portletMethodClasses);

+         holder.processConfigAnnotations(configClasses);

+         holder.processPortletDD(in);     // process portlet xml after annotations

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

          try {

-            ch.validate();         // validate and ignore any validation problems.

+            holder.validate();         // validate and ignore any validation problems.

          } catch (Exception e) {}   

-         pad = ch.getPad();

       } catch (Exception e) {

          e.printStackTrace();

          throw e;

       }

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      pad = holder.getPad();

+      

+      assertNotNull(ams);

+      assertNotNull(summary);

    }

 

    @Before

    public void setUpBefore() throws Exception {

-      assertEquals(3, pad.getPortlets().size());

+      assertEquals(4, pad.getPortlets().size());

       assertNotNull(pad.getPortlet("Portlet1"));

       assertNotNull(pad.getPortlet("Portlet2"));

       assertNotNull(pad.getPortlet("Portlet3"));

@@ -140,14 +157,14 @@
    public void test1processingEvent() throws Exception {

       List<EventDefinitionReference> events = portlet1.getSupportedProcessingEvents();

       assertNotNull(events);

-      assertEquals(0, events.size());

+      assertEquals(2, events.size());

    }

    

    @Test

    public void test1publishingEvent() throws Exception {

       List<EventDefinitionReference> events = portlet1.getSupportedPublishingEvents();

       assertNotNull(events);

-      assertEquals(0, events.size());

+      assertEquals(3, events.size());

    }

   

    // Begin portlet 2 tests ================================== 

@@ -167,14 +184,14 @@
    public void test2processingEvent() throws Exception {

       List<EventDefinitionReference> events = portlet2.getSupportedProcessingEvents();

       assertNotNull(events);

-      assertEquals(0, events.size());

+      assertEquals(2, events.size());

    }

    

    @Test

    public void test2publishingEvent() throws Exception {

       List<EventDefinitionReference> events = portlet2.getSupportedPublishingEvents();

       assertNotNull(events);

-      assertEquals(0, events.size());

+      assertEquals(3, events.size());

    }

    

    // Begin portlet 3 tests ================================== 

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletInvokeTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletInvokeTest.java
index 96f0cfb..538c0c5 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletInvokeTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletInvokeTest.java
@@ -23,33 +23,27 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

 import java.io.InputStream;

 import java.util.HashSet;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.portlet.PortletMode;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.fixtures.InvocationResults;

-import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

+import org.apache.pluto.container.bean.processor.tests.FileHelper;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

-import org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl;

-import org.apache.pluto.container.om.portlet.impl.jsr362.MergePortletAppTest;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet1;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet1a;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet2;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet3;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet4;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.CdiRunner;

 import org.junit.Before;

 import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Tests that the expected portlet methods are present for a portlet app with several

@@ -57,66 +51,58 @@
  * 

  * @author Scott Nicklous

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses({PortletCDIExtension.class, InvokeHelper.class, TestPortlet1.class, TestPortlet1a.class, 

-   TestPortlet2.class, TestPortlet3.class, TestPortlet4.class})

 public class PortletInvokeTest {

    

-   @Inject

-   private InvocationResults meths;

-   

-   @Inject

-   private InvokeHelper helper;

+   private InvocationResults meths = InvocationResults.getInvocationResults();

+   private static InvokeHelper helper;

 

    private static final Class<?> TEST_ANNOTATED_CLASS1 = TestPortlet1.class;

    private static final Class<?> TEST_ANNOTATED_CLASS2 = TestPortlet2.class;

    private static final String XML_FILE = 

          "org/apache/pluto/container/om/portlet/portlet362Reconcile.xml";

 

-   private static PortletApplicationDefinition pad;

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

-   // Classes under test

-   private AnnotatedMethodStore ams = null;

-   private PortletApplicationDefinition app;

+   private static final String pkg = "org.apache.pluto.container.reconcile.fixtures";

+

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

 

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

+      Set<File> portletMethodClasses = FileHelper.getClasses(pkg);

       

-      InputStream in = MergePortletAppTest.class

+      InputStream in = PortletInvokeTest.class

             .getClassLoader().getResourceAsStream(XML_FILE);

 

-      Set<Class<?>> classes = new HashSet<Class<?>>();

-      classes.add(TEST_ANNOTATED_CLASS1);

-      classes.add(TEST_ANNOTATED_CLASS2);

 

-      ConfigurationHolder ch = new ConfigurationHolder();

+      Set<Class<?>> configClasses = new HashSet<Class<?>>();

+      configClasses.add(TEST_ANNOTATED_CLASS1);

+      configClasses.add(TEST_ANNOTATED_CLASS2);

+

       try {

-         ch.processConfigAnnotations(classes);

-         ch.processPortletDD(in);     // process portlet xml after annotations

+         holder.scanMethodAnnotations(portletMethodClasses);

+         holder.processConfigAnnotations(configClasses);

+         holder.processPortletDD(in);     // process portlet xml after annotations

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

          try {

-            ch.validate();         // validate and ignore any validation problems.

+            holder.validate();         // validate and ignore any validation problems.

          } catch (Exception e) {}   

-         pad = ch.getPad();

       } catch (Exception e) {

          e.printStackTrace();

          throw e;

       }

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      

+      assertNotNull(ams);

+      assertNotNull(summary);

+      

+      helper = new InvokeHelper(ams);

    }

 

    @Before

    public void setUpBefore() throws Exception {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      assertNotNull(ams);

-      assertNotNull(helper);

-

-      app = new PortletApplicationDefinitionImpl(pad);

-      ConfigurationHolder coho = new ConfigurationHolder(app);

-      coho.reconcileBeanConfig(ams);

-      

       helper.init("Portlet1", null);

       helper.init("Portlet2", null);

       helper.init("Portlet3", null);

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletMethodTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletMethodTest.java
index e4e7b66..550ba6b 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletMethodTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/PortletMethodTest.java
@@ -23,33 +23,24 @@
 import static org.junit.Assert.assertNotNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

 import java.io.InputStream;

 import java.util.HashSet;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

 import org.apache.pluto.container.bean.processor.MethodIdentifier;

 import org.apache.pluto.container.bean.processor.MethodType;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.tests.FileHelper;

 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

-import org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl;

-import org.apache.pluto.container.om.portlet.impl.jsr362.MergePortletAppTest;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet1;

-import org.apache.pluto.container.reconcile.fixtures.TestPortlet1a;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet2;

-import org.apache.pluto.container.reconcile.fixtures.TestPortlet3;

-import org.apache.pluto.container.reconcile.fixtures.TestPortlet4;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.CdiRunner;

-import org.junit.Before;

 import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Tests that the expected portlet methods are present for a portlet app with several

@@ -57,9 +48,6 @@
  * 

  * @author Scott Nicklous

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses({PortletCDIExtension.class, TestPortlet1.class, TestPortlet1a.class, 

-   TestPortlet2.class, TestPortlet3.class, TestPortlet4.class})

 public class PortletMethodTest {

 

    private static final Class<?> TEST_ANNOTATED_CLASS1 = TestPortlet1.class;

@@ -67,48 +55,46 @@
    private static final String XML_FILE = 

          "org/apache/pluto/container/om/portlet/portlet362Reconcile.xml";

 

-   private static PortletApplicationDefinition pad;

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

+   private static final String pkg = "org.apache.pluto.container.reconcile.fixtures";

+

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+

    // Classes under test

-   private AnnotatedMethodStore ams = null;

-   private PortletApplicationDefinition app;

+   private static PortletApplicationDefinition app;

 

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

+      Set<File> portletMethodClasses = FileHelper.getClasses(pkg);

       

-      InputStream in = MergePortletAppTest.class

+      InputStream in = PortletInvokeTest.class

             .getClassLoader().getResourceAsStream(XML_FILE);

 

-      Set<Class<?>> classes = new HashSet<Class<?>>();

-      classes.add(TEST_ANNOTATED_CLASS1);

-      classes.add(TEST_ANNOTATED_CLASS2);

 

-      ConfigurationHolder ch = new ConfigurationHolder();

+      Set<Class<?>> configClasses = new HashSet<Class<?>>();

+      configClasses.add(TEST_ANNOTATED_CLASS1);

+      configClasses.add(TEST_ANNOTATED_CLASS2);

+

       try {

-         ch.processConfigAnnotations(classes);

-         ch.processPortletDD(in);     // process portlet xml after annotations

+         holder.scanMethodAnnotations(portletMethodClasses);

+         holder.processConfigAnnotations(configClasses);

+         holder.processPortletDD(in);     // process portlet xml after annotations

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

          try {

-            ch.validate();         // validate and ignore any validation problems.

+            holder.validate();         // validate and ignore any validation problems.

          } catch (Exception e) {}   

-         pad = ch.getPad();

       } catch (Exception e) {

          e.printStackTrace();

          throw e;

       }

-   }

-

-   @Before

-   public void setUpBefore() throws Exception {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      app = holder.getPad();

+      

       assertNotNull(ams);

-

-      app = new PortletApplicationDefinitionImpl(pad);

-      ConfigurationHolder coho = new ConfigurationHolder(app);

-      coho.reconcileBeanConfig(ams);

+      assertNotNull(summary);

    }

 

    // Begin portlet app tests ==================================

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ReconcileAnnotatedTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ReconcileAnnotatedTest.java
index cc6755a..67539f1 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ReconcileAnnotatedTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/ReconcileAnnotatedTest.java
@@ -24,17 +24,17 @@
 import static org.junit.Assert.assertNull;

 import static org.junit.Assert.assertTrue;

 

+import java.io.File;

 import java.io.InputStream;

 import java.util.HashSet;

 import java.util.List;

 import java.util.Set;

 

-import javax.inject.Inject;

 import javax.xml.namespace.QName;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

+import org.apache.pluto.container.bean.processor.tests.FileHelper;

 import org.apache.pluto.container.om.portlet.EventDefinitionReference;

 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.PortletDefinition;

@@ -42,17 +42,12 @@
 import org.apache.pluto.container.om.portlet.impl.EventDefinitionReferenceImpl;

 import org.apache.pluto.container.om.portlet.impl.PortletApplicationDefinitionImpl;

 import org.apache.pluto.container.om.portlet.impl.PortletDefinitionImpl;

-import org.apache.pluto.container.om.portlet.impl.jsr362.MergePortletAppTest;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet1;

-import org.apache.pluto.container.reconcile.fixtures.TestPortlet1a;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet2;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet3;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.CdiRunner;

 import org.junit.Before;

 import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Reconciles a bean portlet configuration with a portlet app definition

@@ -60,64 +55,65 @@
  * 

  * @author Scott Nicklous

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses({PortletCDIExtension.class, TestPortlet1.class, 

-   TestPortlet2.class, TestPortlet3.class, TestPortlet1a.class})

 public class ReconcileAnnotatedTest {

 

-   private static final Class<?> TEST_ANNOTATED_CLASS1 = TestPortlet1.class;

-   private static final Class<?> TEST_ANNOTATED_CLASS2 = TestPortlet2.class;

-   private static final String XML_FILE = 

-         "org/apache/pluto/container/om/portlet/portlet362Reconcile.xml";

-

-   private static PortletApplicationDefinition pad;

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

-   private AnnotatedMethodStore ams = null;

-

    // Classes under test

    private PortletApplicationDefinition app;

    private PortletDefinition portlet1;

    private PortletDefinition portlet2;

    private PortletDefinition portlet3;

 

+   private static final Class<?> TEST_ANNOTATED_CLASS1 = TestPortlet1.class;

+   private static final Class<?> TEST_ANNOTATED_CLASS2 = TestPortlet2.class;

+   private static final String XML_FILE = 

+         "org/apache/pluto/container/om/portlet/portlet362Reconcile.xml";

+

+   private static final String pkg = "org.apache.pluto.container.reconcile.fixtures";

+

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+   private static PortletApplicationDefinition pad;

+

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

+      Set<File> portletMethodClasses = FileHelper.getClasses(pkg);

       

-      InputStream in = MergePortletAppTest.class

+      InputStream in = ReconcileAnnotatedTest.class

             .getClassLoader().getResourceAsStream(XML_FILE);

 

-      Set<Class<?>> classes = new HashSet<Class<?>>();

-      classes.add(TEST_ANNOTATED_CLASS1);

-      classes.add(TEST_ANNOTATED_CLASS2);

 

-      ConfigurationHolder ch = new ConfigurationHolder();

+      Set<Class<?>> configClasses = new HashSet<Class<?>>();

+      configClasses.add(TEST_ANNOTATED_CLASS1);

+      configClasses.add(TEST_ANNOTATED_CLASS2);

+

       try {

-         ch.processConfigAnnotations(classes);

-         ch.processPortletDD(in);     // process portlet xml after annotations

+         holder.scanMethodAnnotations(portletMethodClasses);

+         holder.processConfigAnnotations(configClasses);

+         holder.processPortletDD(in);     // process portlet xml after annotations

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

          try {

-            ch.validate();         // validate and ignore any validation problems.

+            holder.validate();         // validate and ignore any validation problems.

          } catch (Exception e) {}   

-         pad = ch.getPad();

       } catch (Exception e) {

          e.printStackTrace();

          throw e;

       }

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      pad = holder.getPad();

+      

+      assertNotNull(ams);

+      assertNotNull(summary);

    }

 

    @Before

    public void setUpBefore() throws Exception {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      assertNotNull(ams);

 

       app = new PortletApplicationDefinitionImpl(pad);

-      ConfigurationHolder coho = new ConfigurationHolder(app);

-      coho.reconcileBeanConfig(ams);

 

-      assertEquals(3, app.getPortlets().size());

+      assertEquals(4, app.getPortlets().size());

       assertNotNull(app.getPortlet("Portlet1"));

       assertNotNull(app.getPortlet("Portlet2"));

       assertNotNull(app.getPortlet("Portlet3"));

diff --git a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/StandAloneBeanPortletInvokeTest.java b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/StandAloneBeanPortletInvokeTest.java
index 61b79f5..496589d 100644
--- a/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/StandAloneBeanPortletInvokeTest.java
+++ b/pluto-container/src/test/java/org/apache/pluto/container/reconcile/tests/StandAloneBeanPortletInvokeTest.java
@@ -22,21 +22,21 @@
 import static org.junit.Assert.assertEquals;

 import static org.junit.Assert.assertNotNull;

 

-import javax.inject.Inject;

+import java.io.File;

+import java.util.HashSet;

+import java.util.Set;

+

 import javax.portlet.PortletMode;

 

-import org.apache.pluto.container.bean.processor.AnnotatedConfigBean;

 import org.apache.pluto.container.bean.processor.AnnotatedMethodStore;

-import org.apache.pluto.container.bean.processor.PortletCDIExtension;

+import org.apache.pluto.container.bean.processor.ConfigSummary;

+import org.apache.pluto.container.bean.processor.tests.FileHelper;

 import org.apache.pluto.container.om.portlet.PortletApplicationDefinition;

 import org.apache.pluto.container.om.portlet.impl.ConfigurationHolder;

 import org.apache.pluto.container.reconcile.fixtures.TestPortlet4;

-import org.jglue.cdiunit.AdditionalClasses;

-import org.jglue.cdiunit.CdiRunner;

 import org.junit.Before;

 import org.junit.BeforeClass;

 import org.junit.Test;

-import org.junit.runner.RunWith;

 

 /**

  * Tests that a bean portlet without accompanying configuration data can

@@ -44,35 +44,54 @@
  * 

  * @author Scott Nicklous

  */

-@RunWith(CdiRunner.class)

-@AdditionalClasses({PortletCDIExtension.class, InvokeHelper.class, TestPortlet4.class})

 public class StandAloneBeanPortletInvokeTest {

    

-   @Inject

-   private InvokeHelper helper;

-   

-   @Inject

-   AnnotatedConfigBean acb;

-   

+   private static final String pkg = "org.apache.pluto.container.reconcile.fixtures";

+

+   private static InvokeHelper helper;

+   private static AnnotatedMethodStore ams = null;

+   private static ConfigSummary summary = null;

+   private static ConfigurationHolder holder =  new ConfigurationHolder();

+

    // Classes under test

-   private AnnotatedMethodStore ams = null;

-   private PortletApplicationDefinition app;

+   private static PortletApplicationDefinition app;

 

    @BeforeClass

    public static void setUpBeforeClass() throws Exception {

+      Set<File> portletMethodClasses = FileHelper.getClasses(pkg);

+      

+      // remve all files but the portlet 4 class

+      Set<File> delFiles = new HashSet<File>();

+      for (File file : portletMethodClasses) {

+         if (!file.getAbsolutePath().contains("Portlet4")) {

+            delFiles.add(file);

+         }

+      }

+      portletMethodClasses.removeAll(delFiles);

+

+      try {

+         holder.scanMethodAnnotations(portletMethodClasses);

+         holder.reconcileBeanConfig();

+         holder.instantiatePortlets(null);

+         try {

+            holder.validate();         // validate and ignore any validation problems.

+         } catch (Exception e) {}   

+      } catch (Exception e) {

+         e.printStackTrace();

+         throw e;

+      }

+      ams = holder.getMethodStore();

+      summary = holder.getConfigSummary();

+      app = holder.getPad();

+      

+      assertNotNull(ams);

+      assertNotNull(summary);

+      

+      helper = new InvokeHelper(ams);

    }

 

    @Before

    public void setUpBefore() throws Exception {

-      assertNotNull(acb);

-      ams = acb.getMethodStore();

-      assertNotNull(ams);

-      assertNotNull(helper);

-

-      ConfigurationHolder coho = new ConfigurationHolder();

-      coho.reconcileBeanConfig(ams);

-      app = coho.getPad();

-      

       helper.init("Portlet4", null);

    }

   

diff --git a/pom.xml b/pom.xml
index a88776f..18b068f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -280,6 +280,7 @@
     <jmock.version>1.2.0</jmock.version>

     <xmlunit.version>1.1</xmlunit.version>

     <cdi.version>2.3.1.Final</cdi.version>

+    <annotation-detector.version>3.0.5</annotation-detector.version>

 

     <!-- The following properties are not directly used as maven

 dependencies, they're used by the maven pluto plugin for

@@ -369,6 +370,13 @@
           <version>${cdi.version}</version>

       </dependency>      

 

+      <!-- For method annotation scanning ==================================== -->

+      <dependency>

+         <groupId>eu.infomas</groupId>

+         <artifactId>annotation-detector</artifactId>

+         <version>${annotation-detector.version}</version>

+      </dependency>

+

       <!--  CCPP Libraries -->

       <dependency>

         <groupId>javax.ccpp</groupId>