[jboss-cvs] JBossAS SVN: r108419 - in projects/ejb3/branches/infinispan-int: metadata-deployers and 16 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Oct 4 11:03:58 EDT 2010


Author: pferraro
Date: 2010-10-04 11:03:56 -0400 (Mon, 04 Oct 2010)
New Revision: 108419

Added:
   projects/ejb3/branches/infinispan-int/metadata-deployers/src/main/java/org/jboss/ejb3/metadata/deployers/EJB31GlobalJNDINamespaceBinderDeployer.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java
Removed:
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/TimerServiceDeployer.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java
Modified:
   projects/ejb3/branches/infinispan-int/core/src/main/java/org/jboss/ejb3/TimerServiceContainer.java
   projects/ejb3/branches/infinispan-int/metadata-deployers/pom.xml
   projects/ejb3/branches/infinispan-int/testsuite/build-test.xml
   projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java
   projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/service/unit/ServiceUnitTestCase.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/pom.xml
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/AutoTimerInitializer.java
   projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/resources/META-INF/jboss-ejb3-timerservice-deployer-jboss-beans.xml
Log:
merge --depth=infinity -r108157:108299

Modified: projects/ejb3/branches/infinispan-int/core/src/main/java/org/jboss/ejb3/TimerServiceContainer.java
===================================================================
--- projects/ejb3/branches/infinispan-int/core/src/main/java/org/jboss/ejb3/TimerServiceContainer.java	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/core/src/main/java/org/jboss/ejb3/TimerServiceContainer.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -92,36 +92,21 @@
     * {@link TimerService} creation is skipped for stateful session beans, since 
     * stateful session beans do not support timerservice
     * 
-    * @see EJBContainer#lockedStart()
+    * @see EJBContainer#create()
     */
    @Override
-   protected void lockedStart() throws Exception
+   public void create() throws Exception
    {
-      try
+      super.create();
+      // for non-stateful beans, create timer service
+      if (this.isStatefulBean() == false)
       {
-         super.lockedStart();
-         // for non-stateful beans, create timer service
-         if (this.isStatefulBean() == false)
-         {
-            // just create the timerservice. Restoring of
-            // any timers, will be done in afterStart(), once the container has fully started
-            // (to allow for timeout method invocations)
-            this.timerService = this.createTimerService();
-         }
-
+         // just create the timerservice. Restoring of
+         // any timers, will be done in afterStart(), once the container has fully started
+         // (to allow for timeout method invocations)
+         this.timerService = this.createTimerService();
       }
-      catch (Exception e)
-      {
-         try
-         {
-            this.lockedStop();
-         }
-         catch (Exception ignore)
-         {
-            logger.debug("Failed to cleanup after start() failure", ignore);
-         }
-         throw e;
-      }
+
    }
 
    /**

Modified: projects/ejb3/branches/infinispan-int/metadata-deployers/pom.xml
===================================================================
--- projects/ejb3/branches/infinispan-int/metadata-deployers/pom.xml	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/metadata-deployers/pom.xml	2010-10-04 15:03:56 UTC (rev 108419)
@@ -24,7 +24,8 @@
       <version.org.jboss.ejb3_deployers>1.1.0</version.org.jboss.ejb3_deployers>
       <version.org.jboss.microcontainer>2.0.8.GA</version.org.jboss.microcontainer>
       <version.org.jboss_jbossxb>2.0.1.GA</version.org.jboss_jbossxb>
-      <version.metadata_ejb>2.0.0-alpha-5</version.metadata_ejb>
+      <version.metadata_ejb>2.0.0-alpha-18</version.metadata_ejb>
+      <version.reloaded.naming.deployer>0.1.0</version.reloaded.naming.deployer>
   </properties>
 
  <build>
@@ -94,6 +95,7 @@
         <groupId>org.jboss.logging</groupId>
         <artifactId>jboss-logging-spi</artifactId>
     </dependency>
+    
 
    <!--  JBoss Metadata -->
    <dependency>

Copied: projects/ejb3/branches/infinispan-int/metadata-deployers/src/main/java/org/jboss/ejb3/metadata/deployers/EJB31GlobalJNDINamespaceBinderDeployer.java (from rev 108299, projects/ejb3/trunk/metadata-deployers/src/main/java/org/jboss/ejb3/metadata/deployers/EJB31GlobalJNDINamespaceBinderDeployer.java)
===================================================================
--- projects/ejb3/branches/infinispan-int/metadata-deployers/src/main/java/org/jboss/ejb3/metadata/deployers/EJB31GlobalJNDINamespaceBinderDeployer.java	                        (rev 0)
+++ projects/ejb3/branches/infinispan-int/metadata-deployers/src/main/java/org/jboss/ejb3/metadata/deployers/EJB31GlobalJNDINamespaceBinderDeployer.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -0,0 +1,212 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.metadata.deployers;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.LinkRef;
+import javax.naming.NamingException;
+
+import org.jboss.beans.metadata.api.annotations.Start;
+import org.jboss.beans.metadata.api.annotations.Stop;
+import org.jboss.beans.metadata.plugins.builder.BeanMetaDataBuilderFactory;
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.jboss.metadata.ejb.jboss.JBossSessionBean31MetaData;
+import org.jboss.metadata.ejb.jboss.jndi.resolver.impl.JNDIPolicyBasedSessionBean31JNDINameResolver;
+import org.jboss.metadata.ejb.jboss.jndipolicy.plugins.JavaEE6JndiBindingPolicy;
+import org.jboss.metadata.ejb.spec.BusinessLocalsMetaData;
+import org.jboss.metadata.ejb.spec.BusinessRemotesMetaData;
+import org.jboss.util.naming.Util;
+
+/**
+ * EJB31GlobalJNDINamespaceBinderDeployer
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class EJB31GlobalJNDINamespaceBinderDeployer extends AbstractDeployer
+{
+
+   private static final String EJB31_GLOBAL_JNDI_NAMESPACE_PREFIX = "java:global/";
+
+   private JNDIPolicyBasedSessionBean31JNDINameResolver javaGlobalNamespaceJNDINameResolver;
+   
+   
+   private JNDIPolicyBasedSessionBean31JNDINameResolver jbossNamingSchemeJNDINameResolver;
+   
+   
+   public EJB31GlobalJNDINamespaceBinderDeployer()
+   {
+      this.setStage(DeploymentStages.REAL);
+      // EJB metadata
+      this.setInput(JBossMetaData.class);
+
+      this.setOutput(BeanMetaData.class);
+      
+      this.javaGlobalNamespaceJNDINameResolver = new JNDIPolicyBasedSessionBean31JNDINameResolver(new JavaEE6JndiBindingPolicy());
+      this.javaGlobalNamespaceJNDINameResolver.setIgnoreJNDIBindingPolicyOnMetaData(true);
+      
+      
+      this.jbossNamingSchemeJNDINameResolver = new JNDIPolicyBasedSessionBean31JNDINameResolver();
+   }
+   
+
+   @Override
+   public void deploy(DeploymentUnit unit) throws DeploymentException
+   {
+      JBossMetaData jbossMetadata = unit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class);
+      if (jbossMetadata.isEJB31() == false)
+      {
+         return;
+      }
+      JBossEnterpriseBeansMetaData enterpriseBeans = jbossMetadata.getEnterpriseBeans();
+      if (enterpriseBeans == null || enterpriseBeans.isEmpty())
+      {
+         return;
+      }
+      for (JBossEnterpriseBeanMetaData enterpriseBean : enterpriseBeans)
+      {
+         if (enterpriseBean.isSession() == false || enterpriseBean instanceof JBossSessionBean31MetaData == false)
+         {
+            continue;
+         }
+         JBossSessionBean31MetaData sessionBean31 = (JBossSessionBean31MetaData) enterpriseBean;
+         this.processBusinessLocals(unit, sessionBean31);
+         this.processBusinessRemotes(unit, sessionBean31);
+         this.processNoInterfaceView(unit, sessionBean31);
+
+      }
+
+   }
+   
+   private void processBusinessLocals(DeploymentUnit unit, JBossSessionBean31MetaData sessionBean31)
+   {
+      BusinessLocalsMetaData businessLocals = sessionBean31.getBusinessLocals();
+      if (businessLocals == null || businessLocals.isEmpty())
+      {
+         return;
+      }
+      for (String businessLocal : businessLocals)
+      {
+         this.generateJNDINames(unit, sessionBean31, businessLocal);
+
+      }
+   }
+   
+   private void processBusinessRemotes(DeploymentUnit unit, JBossSessionBean31MetaData sessionBean31)
+   {
+      BusinessRemotesMetaData businessRemotes = sessionBean31.getBusinessRemotes();
+      if (businessRemotes == null || businessRemotes.isEmpty())
+      {
+         return;
+      }
+      for (String businessLocal : businessRemotes)
+      {
+         this.generateJNDINames(unit, sessionBean31, businessLocal);
+
+      }
+   }
+   
+   private void processNoInterfaceView(DeploymentUnit unit, JBossSessionBean31MetaData sessionBean31)
+   {
+      if (sessionBean31.isNoInterfaceBean() == false)
+      {
+         return;
+      }
+      this.generateJNDINames(unit, sessionBean31, sessionBean31.getEjbClass());
+   }
+   
+   private void generateJNDINames(DeploymentUnit unit, JBossSessionBean31MetaData sessionBean31, String className)
+   {
+      String jbossSpecificJNDIName = this.jbossNamingSchemeJNDINameResolver.resolveJNDIName(sessionBean31, className);
+      
+      String javaGlobalJNDIName = EJB31_GLOBAL_JNDI_NAMESPACE_PREFIX + this.javaGlobalNamespaceJNDINameResolver.resolveJNDIName(sessionBean31, className);
+      Context ctx;
+      try
+      {
+         ctx = new InitialContext();
+      }
+      catch (NamingException ne)
+      {
+         throw new RuntimeException(ne);
+      }
+      LinkRef javaGlobalLinkRef = new LinkRef(jbossSpecificJNDIName);
+      
+      JNDIBinder javaGlobalJNDIBinder = new JNDIBinder(ctx, javaGlobalJNDIName, javaGlobalLinkRef);
+      
+      this.attachJNDIBinder(unit, javaGlobalJNDIBinder);
+   }
+
+   private void attachJNDIBinder(DeploymentUnit unit, JNDIBinder binder)
+   {
+      String mcBeanName = "javaee6-portable-jndibinder:" + binder.jndiName;
+      BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(mcBeanName, JNDIBinder.class.getName());
+      builder.setConstructorValue(binder);
+
+      unit.addAttachment(mcBeanName, builder.getBeanMetaData());
+   }
+   
+
+   private class JNDIBinder
+   {
+      private Context jndiCtx;
+
+      private String jndiName;
+
+      private Object jndiObject;
+
+      private boolean bound;
+
+      JNDIBinder(Context ctx, String jndiName, Object object)
+      {
+         this.jndiCtx = ctx;
+         this.jndiName = jndiName;
+         this.jndiObject = object;
+      }
+
+      @Start
+      public void start() throws NamingException
+      {
+         Util.bind(this.jndiCtx, this.jndiName, this.jndiObject);
+         this.bound = true;
+      }
+
+      @Stop
+      public void stop() throws NamingException
+      {
+         if (bound)
+         {
+            Util.unbind(this.jndiCtx, this.jndiName);
+         }
+      }
+   }
+
+}

Modified: projects/ejb3/branches/infinispan-int/testsuite/build-test.xml
===================================================================
--- projects/ejb3/branches/infinispan-int/testsuite/build-test.xml	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/testsuite/build-test.xml	2010-10-04 15:03:56 UTC (rev 108419)
@@ -1131,16 +1131,8 @@
 
       <mkdir dir="${build.lib}"/>
 
-      <jar jarfile="${build.lib}/asynchronous-test.sar">
+       <jar jarfile="${build.lib}/asynchronous-test.jar">
          <fileset dir="${build.classes}">
-            <include name="org/jboss/ejb3/test/asynchronous/Tester*.class"/>
-         </fileset>
-         <fileset dir="${resources}/test/asynchronous">
-            <include name="META-INF/jboss-service.xml"/>
-         </fileset>
-      </jar>
-      <jar jarfile="${build.lib}/asynchronous-test.jar">
-         <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/asynchronous/*.class"/>
          </fileset>
          <fileset dir="${resources}/test">
@@ -1149,6 +1141,7 @@
          </fileset>
          <fileset dir="${resources}/test/asynchronous">
             <include name="META-INF/persistence.xml"/>
+			<include name="META-INF/jboss-service.xml"/>
          </fileset>
       </jar>
    </target>
@@ -3804,14 +3797,7 @@
 
       <mkdir dir="${build.lib}"/>
 
-      <jar jarfile="${build.lib}/service-test.sar">
-         <fileset dir="${build.classes}">
-            <include name="org/jboss/ejb3/test/service/Tester*.class"/>
-         </fileset>
-         <fileset dir="${resources}/test/service">
-            <include name="META-INF/jboss-service.xml"/>
-         </fileset>
-      </jar>
+     
       <jar jarfile="${build.lib}/service-test.jar">
          <fileset dir="${build.classes}">
             <include name="org/jboss/ejb3/test/service/*.class"/>
@@ -3820,6 +3806,7 @@
             <include name="META-INF/ejb-jar.xml"/>
             <include name="META-INF/jboss.xml"/>
             <include name="META-INF/persistence.xml"/>
+			<include name="META-INF/jboss-service.xml"/>             
          </fileset>
          <fileset dir="${resources}/test">
             <include name="users.properties"/>

Modified: projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java
===================================================================
--- projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/asynchronous/unit/AsynchronousTestCase.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -220,7 +220,7 @@
 
    public static Test suite() throws Exception
    {
-      return getDeploySetup(AsynchronousTestCase.class, "asynchronous-test.sar, asynchronous-test.jar");
+      return getDeploySetup(AsynchronousTestCase.class, "asynchronous-test.jar");
    }
 
 

Modified: projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/service/unit/ServiceUnitTestCase.java
===================================================================
--- projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/service/unit/ServiceUnitTestCase.java	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/testsuite/src/test/java/org/jboss/ejb3/test/service/unit/ServiceUnitTestCase.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -508,7 +508,7 @@
 
    public static Test suite() throws Exception
    {
-      return new TestSetup(getDeploySetup(ServiceUnitTestCase.class, "service-test.sar, service-test.jar"))
+      return new TestSetup(getDeploySetup(ServiceUnitTestCase.class, "service-test.jar"))
       {
          @Override
          protected void setUp() throws Exception

Modified: projects/ejb3/branches/infinispan-int/timerservice-deployer/pom.xml
===================================================================
--- projects/ejb3/branches/infinispan-int/timerservice-deployer/pom.xml	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/pom.xml	2010-10-04 15:03:56 UTC (rev 108419)
@@ -11,34 +11,34 @@
     <groupId>org.jboss.ejb3</groupId>
     <artifactId>jboss-ejb3-timerservice-deployer</artifactId>
     <packaging>jar</packaging>
-    <version>1.0.0-SNAPSHOT</version>
+    <version>1.0.0-alpha-6-SNAPSHOT</version>
     <name>JBoss EJB3.1+ Timerservice deployer</name>
     <url>http://www.jboss.org</url>
     <description>MC based deployer(s) for timerservice functionality for EJB containers</description>
-    
-	<!-- SCM -->
-	<scm>
-		<connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/timerservice-deployer</connection>
-		<developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/ejb3/trunk/timerservice-deployer</developerConnection>
-		<url>http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/timerservice-deployer</url>
-	</scm>
 
-	<distributionManagement>
-			<repository>
-			  <id>jboss-releases-repository</id>
-			  <name>JBoss Releases Repository</name>
-			  <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
-			</repository>
+    <!-- SCM -->
+    <scm>
+        <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/timerservice-deployer</connection>
+        <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/ejb3/trunk/timerservice-deployer</developerConnection>
+        <url>http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/trunk/timerservice-deployer</url>
+    </scm>
 
-			<snapshotRepository>
-				<id>jboss-snapshots-repository</id>
-				<name>JBoss Snapshots Repository</name>
-				<url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
-			</snapshotRepository>			
-	</distributionManagement>  
+    <distributionManagement>
+        <repository>
+            <id>jboss-releases-repository</id>
+            <name>JBoss Releases Repository</name>
+            <url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</url>
+        </repository>
 
-    
-    
+        <snapshotRepository>
+            <id>jboss-snapshots-repository</id>
+            <name>JBoss Snapshots Repository</name>
+            <url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>
+        </snapshotRepository>
+    </distributionManagement>
+
+
+
     <properties>
         <version.org.jboss.deployers>2.2.0.Alpha5</version.org.jboss.deployers>
         <version.org.jboss.kernel>2.2.0.Alpha10</version.org.jboss.kernel>
@@ -46,8 +46,10 @@
         <version.org.jboss.ejb.metadata>2.0.0-alpha-16</version.org.jboss.ejb.metadata>
         <version.org.jboss.ejb3.timerservice_timerservice-extension>1.0.0-alpha-2</version.org.jboss.ejb3.timerservice_timerservice-extension>
         <version.junit>4.7</version.junit>
+        <version.mockito>1.8.4</version.mockito>
+        <version.org.jboss.ejb3.timeout>0.2.1</version.org.jboss.ejb3.timeout>
     </properties>
-    
+
     <build>
         <plugins>
             <!-- Assembly Plugin -->
@@ -56,63 +58,63 @@
                 <version>2.2-beta-4</version>
                 <executions>
                     <!--  Build timerservice deployer "package" -->
-                  <execution>
-                    <id>build-timerservice-deployer-package</id> 
-                    <phase>package</phase>
-                    <goals>
-                      <goal>single</goal>
-                    </goals>
-                  </execution>
+                    <execution>
+                        <id>build-timerservice-deployer-package</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>single</goal>
+                        </goals>
+                    </execution>
                 </executions>
                 <configuration>
-                  <descriptors>
-                    <descriptor>src/assembly/package-assembler.xml</descriptor>
-                  </descriptors>
+                    <descriptors>
+                        <descriptor>src/assembly/package-assembler.xml</descriptor>
+                    </descriptors>
                 </configuration>
             </plugin>
-			<plugin>
-				<artifactId>maven-compiler-plugin</artifactId>
-				<configuration>
-					<source>1.6</source>
-					<target>1.6</target>
-				</configuration>
-			</plugin>
+            <plugin>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>1.6</source>
+                    <target>1.6</target>
+                </configuration>
+            </plugin>
 
-			<plugin>
-				<artifactId>maven-enforcer-plugin</artifactId>
-				<executions>
-					<execution>
-						<id>enforce-jdk6</id>
-						<goals>
-							<goal>enforce</goal>
-						</goals>
-						<configuration>
-							<rules>
-								<requireJavaVersion>
-									<version>[1.6,)</version>
-								</requireJavaVersion>
-							</rules>
-						</configuration>
-					</execution>
-				</executions>
-			</plugin>
-			<!-- Maven Release Plugin Configuration -->
-			<plugin>
-				<groupId>org.apache.maven.plugins</groupId>
-				<artifactId>maven-release-plugin</artifactId>
-				<configuration>
-					<tagBase>
-						https://svn.jboss.org/repos/jbossas/projects/ejb3/tags
+            <plugin>
+                <artifactId>maven-enforcer-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>enforce-jdk6</id>
+                        <goals>
+                            <goal>enforce</goal>
+                        </goals>
+                        <configuration>
+                            <rules>
+                                <requireJavaVersion>
+                                    <version>[1.6,)</version>
+                                </requireJavaVersion>
+                            </rules>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <!-- Maven Release Plugin Configuration -->
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-release-plugin</artifactId>
+                <configuration>
+                    <tagBase>
+                        https://svn.jboss.org/repos/jbossas/projects/ejb3/tags
 			          </tagBase>
-				</configuration>
-			</plugin>
+                </configuration>
+            </plugin>
 
-			
-            
+
+
         </plugins>
-    
+
     </build>
-    
+
     <dependencies>
 
         <dependency>
@@ -120,43 +122,50 @@
             <artifactId>jboss-metadata-ejb</artifactId>
             <version>${version.org.jboss.ejb.metadata}</version>
         </dependency>
+
         <dependency>
-        	<groupId>org.jboss.ejb3</groupId>
-        	<artifactId>jboss-ejb3-common</artifactId>
-        	<version>1.0.0</version>
+            <groupId>org.jboss.ejb3.timeout</groupId>
+            <artifactId>jboss-ejb3-timeout-spi</artifactId>
+            <version>${version.org.jboss.ejb3.timeout}</version>
         </dependency>
+
         <dependency>
-        	<groupId>org.jboss.ejb3</groupId>
-        	<artifactId>jboss-ejb3-core</artifactId>
-        	<version>${version.org.jboss.ejb3.core}</version>
+            <groupId>org.jboss.ejb3</groupId>
+            <artifactId>jboss-ejb3-common</artifactId>
+            <version>1.0.0</version>
         </dependency>
         <dependency>
-        	<groupId>org.jboss.ejb3.timerservice</groupId>
-        	<artifactId>jboss-ejb3-timerservice-extension</artifactId>
-        	<version>${version.org.jboss.ejb3.timerservice_timerservice-extension}</version>
+            <groupId>org.jboss.ejb3</groupId>
+            <artifactId>jboss-ejb3-core</artifactId>
+            <version>${version.org.jboss.ejb3.core}</version>
         </dependency>
+        <dependency>
+            <groupId>org.jboss.ejb3.timerservice</groupId>
+            <artifactId>jboss-ejb3-timerservice-extension</artifactId>
+            <version>${version.org.jboss.ejb3.timerservice_timerservice-extension}</version>
+        </dependency>
         <!-- JBoss deployers -->
         <dependency>
-        	<groupId>org.jboss.kernel</groupId>
-        	<artifactId>jboss-kernel</artifactId>
-        	<version>${version.org.jboss.kernel}</version>
+            <groupId>org.jboss.kernel</groupId>
+            <artifactId>jboss-kernel</artifactId>
+            <version>${version.org.jboss.kernel}</version>
         </dependency>
         <dependency>
-          <groupId>org.jboss.deployers</groupId>
-          <artifactId>jboss-deployers-spi</artifactId>
-          <version>${version.org.jboss.deployers}</version>
+            <groupId>org.jboss.deployers</groupId>
+            <artifactId>jboss-deployers-spi</artifactId>
+            <version>${version.org.jboss.deployers}</version>
         </dependency>
         <dependency>
-          <groupId>org.jboss.deployers</groupId>
-          <artifactId>jboss-deployers-core-spi</artifactId>
-          <version>${version.org.jboss.deployers}</version>
+            <groupId>org.jboss.deployers</groupId>
+            <artifactId>jboss-deployers-core-spi</artifactId>
+            <version>${version.org.jboss.deployers}</version>
         </dependency>
         <dependency>
-          <groupId>org.jboss.deployers</groupId>
-          <artifactId>jboss-deployers-structure-spi</artifactId>
-          <version>${version.org.jboss.deployers}</version>
+            <groupId>org.jboss.deployers</groupId>
+            <artifactId>jboss-deployers-structure-spi</artifactId>
+            <version>${version.org.jboss.deployers}</version>
         </dependency>
-        
+
         <!-- ***************************** -->
         <!--  Test dependencies -->
         <!-- ***************************** -->
@@ -166,7 +175,56 @@
             <version>${version.junit}</version>
             <scope>test</scope>
         </dependency>
-    
+
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <version>${version.mockito}</version>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.jboss.ejb3.timeout</groupId>
+            <artifactId>jboss-ejb3-timeout-3.1</artifactId>
+            <version>${version.org.jboss.ejb3.timeout}</version>
+        </dependency>
+
+        <!-- Test runtime -->
+        <dependency>
+            <groupId>org.jboss.jbossas</groupId>
+            <artifactId>jboss-as-server</artifactId>
+            <version>5.1.0.GA</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>jboss</groupId>
+                    <artifactId>jboss-remoting</artifactId>
+                </exclusion>
+                <!-- jboss-as-server must not dictate the JPA API -->
+                <exclusion>
+                    <groupId>org.hibernate</groupId>
+                    <artifactId>ejb3-persistence</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.jboss</groupId>
+                    <artifactId>jboss-metadata</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.jboss.jbossas</groupId>
+                    <artifactId>jboss-as-security</artifactId>
+                </exclusion>
+                <!-- Conflicts with org.jboss.security:jbosssx -->
+                <exclusion>
+                    <groupId>org.jboss.security</groupId>
+                    <artifactId>jbosssx-client</artifactId>
+                </exclusion>
+                <exclusion>
+                    <groupId>org.jboss.ws.native</groupId>
+                    <artifactId>jbossws-native-jaxws</artifactId>
+                </exclusion>
+            </exclusions>
+            <scope>provided</scope>
+        </dependency>
+
     </dependencies>
 
 </project>	

Modified: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/AutoTimerInitializer.java
===================================================================
--- projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/AutoTimerInitializer.java	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/AutoTimerInitializer.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -28,9 +28,11 @@
 import javax.ejb.TimerConfig;
 import javax.ejb.TimerService;
 
-import org.jboss.beans.metadata.api.annotations.Start;
+import org.jboss.beans.metadata.api.annotations.Install;
+import org.jboss.dependency.spi.ControllerState;
 import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.common.lang.ClassHelper;
+import org.jboss.ejb3.timeout.spi.TimeoutMethodCallbackRequirements;
+import org.jboss.ejb3.util.Service;
 import org.jboss.logging.Logger;
 import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
 import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBean31MetaData;
@@ -41,6 +43,14 @@
 
 /**
  * Responsible for creating any necessary auto timers for an EJB
+ * 
+ * <p>
+ *  The {@link AutoTimerInitializer} "listens" for {@link EJBContainer}s which
+ *  reach {@link ControllerState#START} state. The {@link AutoTimerInitializer} 
+ *  then checks the EJB metadata associated with such containers and decides whether auto-timers
+ *  have to be created for that container. For any such relevant container, this {@link AutoTimerInitializer}
+ *  then creates the auto-timer(s).  
+ * </p>
  *
  * @author Jaikiran Pai
  * @version $Revision: $
@@ -53,60 +63,22 @@
     */
    private static Logger logger = Logger.getLogger(AutoTimerInitializer.class);
 
-   /**
-    * The EJB container
-    */
-   private EJBContainer container;
+   /** timeout method requirements checker */
+   private static TimeoutMethodCallbackRequirements timeoutMethodCallbackRequirements = Service
+         .loadService(TimeoutMethodCallbackRequirements.class);
 
+   
    /**
+    * Creates auto-timer(s) for the passed {@link EJBContainer} if the corresponding EJB has auto-timers
+    * configured
     * 
+    * @param container The EJB container
     */
-   public AutoTimerInitializer()
+   @Install (dependentState = "Start") // we work with containers in "Start" state because that's when the container
+   // is available for invocations (for timeout methods).
+   public void initializeAutoTimers(EJBContainer container)
    {
-
-   }
-
-   /**
-    * Creates a {@link AutoTimerInitializer} for a {@link EJBContainer}
-    * @param container {@link EJBContainer}
-    */
-   public AutoTimerInitializer(EJBContainer container)
-   {
-      this.container = container;
-   }
-
-   /**
-    * Sets the {@link EJBContainer}
-    * @param container {@link EJBContainer}
-    */
-   public void setContainer(EJBContainer container)
-   {
-      this.container = container;
-   }
-
-   /**
-    * Returns the {@link EJBContainer} for which this {@link AutoTimerInitializer} is responsible
-    * for creating auto timers
-    * @return
-    */
-   public EJBContainer getContainer()
-   {
-      return this.container;
-   }
-
-   /**
-    * Creates any auto timers that are required for the {@link EJBContainer}, which this
-    * {@link AutoTimerInitializer} represents.
-    */
-   @Start
-   public void initializeAutoTimers()
-   {
-      if (this.container == null)
-      {
-         throw new IllegalStateException("Cannot initialize auto-timers since container is not present");
-      }
-
-      JBossEnterpriseBeanMetaData enterpriseBeanMetaData = this.container.getXml();
+      JBossEnterpriseBeanMetaData enterpriseBeanMetaData = container.getXml();
       // Auto timers are only since EJB3.1
       // TODO: This check will fail when EJB3.2 or any newer versions are introduced.
       // A better check would be to look for any version greater than EJB3.1
@@ -114,9 +86,8 @@
       {
          return;
       }
-
       List<TimerMetaData> autoTimersMetaData = null;
-
+      // Session bean
       if (enterpriseBeanMetaData.isSession() && enterpriseBeanMetaData instanceof JBossSessionBean31MetaData)
       {
          JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) enterpriseBeanMetaData;
@@ -128,6 +99,7 @@
          // Get hold of the auto timer metadata
          autoTimersMetaData = sessionBean.getTimers();
       }
+      // MDB
       else if (enterpriseBeanMetaData.isMessageDriven()
             && enterpriseBeanMetaData instanceof JBossMessageDrivenBean31MetaData)
       {
@@ -142,7 +114,7 @@
       }
 
       // get hold of the timerservice since we need it to create the autotimers
-      TimerService timerService = this.container.getTimerService();
+      TimerService timerService = container.getTimerService();
 
       if (timerService instanceof org.jboss.ejb3.timerservice.extension.TimerService == false)
       {
@@ -159,10 +131,14 @@
          // create a timer config
          TimerConfig timerConfig = new TimerConfig();
          timerConfig.setPersistent(autoTimerMetaData.isPersistent());
-         timerConfig.setInfo(autoTimerMetaData.getInfo());
+         String info = autoTimerMetaData.getInfo(); 
+         if (info != null && !info.isEmpty())
+         {
+            timerConfig.setInfo(autoTimerMetaData.getInfo());
+         }
          NamedMethodMetaData timeoutMethodMetaData = autoTimerMetaData.getTimeoutMethod();
          // get hold of the timeout method for this auto-timer
-         Method timeoutMethod = this.getTimeoutMethod(timeoutMethodMetaData, this.container.getBeanClass());
+         Method timeoutMethod = this.getTimeoutMethod(timeoutMethodMetaData, container.getBeanClass());
          if (timeoutMethod == null)
          {
             StringBuilder methodStringBuilder = new StringBuilder();
@@ -196,67 +172,28 @@
 
       String timeoutMethodName = timeoutMethodMetaData.getMethodName();
       MethodParametersMetaData timeoutMethodParams = timeoutMethodMetaData.getMethodParams();
-
-      List<Method> probableTimeoutMethods = ClassHelper.getAllMethodsByName(beanClass, timeoutMethodName);
-      if (probableTimeoutMethods == null || probableTimeoutMethods.isEmpty())
+      Class<?>[] timeoutMethodParamTypes = null;
+      if (timeoutMethodParams != null)
       {
-         return null;
-      }
-      if (timeoutMethodParams == null)
-      {
-         if (probableTimeoutMethods.size() > 1)
+         // load the method param classes
+         timeoutMethodParamTypes = new Class<?>[timeoutMethodParams.size()];
+         int i = 0;
+         for (String paramClassName : timeoutMethodParams)
          {
-            throw new IllegalStateException("Found more than one timeout method with name: " + timeoutMethodName
-                  + " on bean " + beanClass);
+            Class<?> methodParamClass = null;
+            try
+            {
+               methodParamClass = Class.forName(paramClassName, false, beanClass.getClassLoader());
+            }
+            catch (ClassNotFoundException cnfe)
+            {
+               throw new RuntimeException("Could not load method param class: " + paramClassName + " of timeout method");
+            }
+            timeoutMethodParamTypes[i++] = methodParamClass;
          }
-         // match found
-         return probableTimeoutMethods.get(0);
       }
-
-      // load the method param classes
-      Class<?>[] timeoutMethodParamTypes = new Class<?>[timeoutMethodParams.size()];
-      int i = 0;
-      for (String paramClassName : timeoutMethodParams)
-      {
-         Class<?> methodParamClass = null;
-         try
-         {
-            methodParamClass = Class.forName(paramClassName, false, beanClass.getClassLoader());
-         }
-         catch (ClassNotFoundException cnfe)
-         {
-            throw new RuntimeException("Could not load method param class: " + paramClassName + " of timeout method");
-         }
-         timeoutMethodParamTypes[i++] = methodParamClass;
-      }
-      for (Method method : probableTimeoutMethods)
-      {
-         Class<?>[] methodParamTypes = method.getParameterTypes();
-         if (equals(timeoutMethodParamTypes, methodParamTypes))
-         {
-            // match found
-            return method;
-         }
-      }
-      // no match found
-      return null;
+      return timeoutMethodCallbackRequirements.getTimeoutMethod(beanClass, timeoutMethodName, timeoutMethodParamTypes);
    }
 
-   private boolean equals(Class<?>[] params, Class<?>[] otherParams)
-   {
 
-      if (params.length != otherParams.length)
-      {
-         return false;
-      }
-      for (int i = 0; i < params.length; i++)
-      {
-         // param type doesn't match
-         if (!params[i].equals(otherParams[i]))
-         {
-            return false;
-         }
-      }
-      return true;
-   }
 }

Deleted: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/TimerServiceDeployer.java
===================================================================
--- projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/TimerServiceDeployer.java	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/java/org/jboss/ejb3/timerservice/deployer/TimerServiceDeployer.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -1,162 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.timerservice.deployer;
-
-import org.jboss.beans.metadata.plugins.AbstractInjectionValueMetaData;
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.common.deployers.spi.AttachmentNames;
-import org.jboss.logging.Logger;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeansMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
-
-/**
- * A deployer which processing EJB3.1 bean metadata and creating {@link AutoTimerInitializer}
- * for appropriate EJBs.
- * <p>
- *  Each such {@link AutoTimerInitializer} will be attached to the {@link DeploymentUnit} as a
- *  {@link BeanMetaData} so that it's deployed as a MC bean.
- * </p>
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class TimerServiceDeployer extends AbstractDeployer
-{
-
-   /**
-    * Logger
-    */
-   private Logger logger = Logger.getLogger(TimerServiceDeployer.class);
-
-   /**
-    * MC bean name prefix
-    */
-   private static final String AUTO_TIMER_MC_BEAN_PREFIX = "auto-timer-initializer:";
-
-   /**
-    * Setup the deployer
-    */
-   public TimerServiceDeployer()
-   {
-      // run in REAL stage
-      setStage(DeploymentStages.REAL);
-      // we need JBossMetaData
-      setInput(JBossMetaData.class);
-      // ordering (i.e. this deployer should run after the deployer which attaches PROCESSED_METADATA to the unit) 
-      addInput(AttachmentNames.PROCESSED_METADATA);
-      // we deploy MC bean(s)
-      addOutput(BeanMetaData.class);
-   }
-
-   /**
-    * For each EJB3.1 bean in this <code>unit</code>, this method creates a {@link AutoTimerInitializer} and attaches it
-    * as {@link BeanMetaData} to the <code>unit</code> 
-    */
-   @Override
-   public void deploy(DeploymentUnit unit) throws DeploymentException
-   {
-      // get processed metadata
-      JBossMetaData metaData = unit.getAttachment(AttachmentNames.PROCESSED_METADATA, JBossMetaData.class);
-      if (metaData == null)
-      {
-         return;
-      }
-      // Auto timers are only since EJB3.1
-      // TODO: This check will fail when EJB3.2 or any newer versions are introduced.
-      // A better check would be to look for any version greater than EJB3.1
-      if (metaData.isEJB31() == false)
-      {
-         return;
-      }
-      // work on the ejbs
-      JBossEnterpriseBeansMetaData beans = metaData.getEnterpriseBeans();
-      for (JBossEnterpriseBeanMetaData bean : beans)
-      {
-         if (bean.isSession())
-         {
-            JBossSessionBeanMetaData sessionBean = (JBossSessionBeanMetaData) bean;
-            // stateful beans don't have timerservice/timers
-            if (sessionBean.isStateful())
-            {
-               continue;
-            }
-         }
-         // ignore entity and (JBoss specific) @Service beans
-         else if (bean.isEntity() || bean.isService())
-         {
-            continue;
-         }
-         // process
-         String mcBeanName = AUTO_TIMER_MC_BEAN_PREFIX + unit.getName() + "$" + bean.getEjbName();
-         // create the BeanMetadata for the AutoTimerInitializer
-         BeanMetaData bmd = this.createAutoTimerInitializer(mcBeanName, bean);
-         // add it as attachment
-         unit.addAttachment(BeanMetaData.class + ":" + mcBeanName, bmd);
-      }
-   }
-
-   /**
-    * Returns {@link BeanMetaData} for a {@link AutoTimerInitializer} instance
-    * <p>
-    *   The MC bean for {@link AutoTimerInitializer} created by this method will be configured
-    *   to depend on the {@link ControllerState#INSTALLED} state of the MC bean corresponding
-    *   to the {@link EJBContainer}. The EJB container MC bean on which the {@link AutoTimerInitializer}
-    *   will depend, is obtained through {@link JBossEnterpriseBeanMetaData#getContainerName()}. 
-    * </p>  
-    * <p>
-    *   Furthermore, the MC bean for {@link AutoTimerInitializer} will be configured to inject
-    *   the {@link EJBContainer} into the {@link AutoTimerInitializer} instance
-    * </p>
-    * @param mcBeanName The name of the MC bean being created
-    * @param bean Bean metadata
-    * @return
-    */
-   private BeanMetaData createAutoTimerInitializer(String mcBeanName, JBossEnterpriseBeanMetaData bean)
-   {
-      AutoTimerInitializer autoTimerInitializer = new AutoTimerInitializer();
-
-      BeanMetaDataBuilder builder = BeanMetaDataBuilder.createBuilder(mcBeanName, autoTimerInitializer.getClass()
-            .getName());
-      builder.setConstructorValue(autoTimerInitializer);
-
-      // add dependency - the AutoTimerInitializer will depend on a INSTALLED state of EJBContainer
-      AbstractInjectionValueMetaData injectMetaData = new AbstractInjectionValueMetaData(bean.getContainerName());
-      injectMetaData.setDependentState(ControllerState.INSTALLED);
-
-      // TODO: Too bad we have to know the field name. Need to do more research on MC to see if we can
-      // add property metadata based on type instead of field name.
-      // Add the injection point in AutoTimerInitializer to inject the EJBContainer
-      builder.addPropertyMetaData("container", injectMetaData);
-
-      // return the BeanMetaData
-      return builder.getBeanMetaData();
-   }
-}

Modified: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/resources/META-INF/jboss-ejb3-timerservice-deployer-jboss-beans.xml
===================================================================
--- projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/resources/META-INF/jboss-ejb3-timerservice-deployer-jboss-beans.xml	2010-10-04 14:41:47 UTC (rev 108418)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/main/resources/META-INF/jboss-ejb3-timerservice-deployer-jboss-beans.xml	2010-10-04 15:03:56 UTC (rev 108419)
@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <deployment xmlns="urn:jboss:bean-deployer:2.0">
 
-    
-    <!-- EJB3.1 timerservice deployer -->
-    <bean name="TimerServiceDeployer" class="org.jboss.ejb3.timerservice.deployer.TimerServiceDeployer"/>
-       
-    
+
+    <!--  Processes EJB3.1 beans and starts the auto-timers (if any) configured for those beans -->
+    <bean name="AutoTimerInitializer"
+        class="org.jboss.ejb3.timerservice.deployer.AutoTimerInitializer" />
+
+
 </deployment>
\ No newline at end of file

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org)

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss)

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3 (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3)

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice)

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer)

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test)

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer)

Deleted: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java
===================================================================
--- projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java	2010-09-23 15:54:35 UTC (rev 108299)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -1,143 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.timerservice.deployer.test.autotimer;
-
-import java.io.Serializable;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.ejb.EJBException;
-import javax.ejb.ScheduleExpression;
-import javax.ejb.TimerConfig;
-
-import org.jboss.ejb3.timerservice.extension.Timer;
-import org.jboss.ejb3.timerservice.extension.TimerService;
-
-/**
- * MockTimerService
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class MockTimerService implements TimerService
-{
-
-   private Map<Method, ScheduleExpression> autoTimerInfo = new HashMap<Method, ScheduleExpression>();
-   
-   @Override
-   public Timer getAutoTimer(ScheduleExpression schedule, Method timeoutMethod)
-   {
-      return this.getAutoTimer(schedule, null, timeoutMethod);
-   }
-
-   @Override
-   public Timer getAutoTimer(ScheduleExpression schedule, TimerConfig timerConfig, Method timeoutMethod)
-   {
-      this.autoTimerInfo.put(timeoutMethod, schedule);
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createCalendarTimer(ScheduleExpression schedule) throws IllegalArgumentException,
-         IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig)
-         throws IllegalArgumentException, IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createIntervalTimer(Date initialExpiration, long intervalDuration, TimerConfig timerConfig)
-         throws IllegalArgumentException, IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createIntervalTimer(long initialDuration, long intervalDuration, TimerConfig timerConfig)
-         throws IllegalArgumentException, IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createSingleActionTimer(Date expiration, TimerConfig timerConfig)
-         throws IllegalArgumentException, IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createSingleActionTimer(long duration, TimerConfig timerConfig)
-         throws IllegalArgumentException, IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createTimer(long duration, Serializable info) throws IllegalArgumentException,
-         IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createTimer(Date expiration, Serializable info) throws IllegalArgumentException,
-         IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createTimer(long initialDuration, long intervalDuration, Serializable info)
-         throws IllegalArgumentException, IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public javax.ejb.Timer createTimer(Date initialExpiration, long intervalDuration, Serializable info)
-         throws IllegalArgumentException, IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   @Override
-   public Collection<javax.ejb.Timer> getTimers() throws IllegalStateException, EJBException
-   {
-      return null;
-   }
-
-   public Map<Method, ScheduleExpression> getAutoTimers()
-   {
-      return this.autoTimerInfo;
-   }
-   
-}

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java)
===================================================================
--- projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java	                        (rev 0)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/MockTimerService.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -0,0 +1,143 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.timerservice.deployer.test.autotimer;
+
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.ejb.EJBException;
+import javax.ejb.ScheduleExpression;
+import javax.ejb.TimerConfig;
+
+import org.jboss.ejb3.timerservice.extension.Timer;
+import org.jboss.ejb3.timerservice.extension.TimerService;
+
+/**
+ * MockTimerService
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class MockTimerService implements TimerService
+{
+
+   private Map<Method, ScheduleExpression> autoTimerInfo = new HashMap<Method, ScheduleExpression>();
+   
+   @Override
+   public Timer getAutoTimer(ScheduleExpression schedule, Method timeoutMethod)
+   {
+      return this.getAutoTimer(schedule, null, timeoutMethod);
+   }
+
+   @Override
+   public Timer getAutoTimer(ScheduleExpression schedule, TimerConfig timerConfig, Method timeoutMethod)
+   {
+      this.autoTimerInfo.put(timeoutMethod, schedule);
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createCalendarTimer(ScheduleExpression schedule) throws IllegalArgumentException,
+         IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createCalendarTimer(ScheduleExpression schedule, TimerConfig timerConfig)
+         throws IllegalArgumentException, IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createIntervalTimer(Date initialExpiration, long intervalDuration, TimerConfig timerConfig)
+         throws IllegalArgumentException, IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createIntervalTimer(long initialDuration, long intervalDuration, TimerConfig timerConfig)
+         throws IllegalArgumentException, IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createSingleActionTimer(Date expiration, TimerConfig timerConfig)
+         throws IllegalArgumentException, IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createSingleActionTimer(long duration, TimerConfig timerConfig)
+         throws IllegalArgumentException, IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createTimer(long duration, Serializable info) throws IllegalArgumentException,
+         IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createTimer(Date expiration, Serializable info) throws IllegalArgumentException,
+         IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createTimer(long initialDuration, long intervalDuration, Serializable info)
+         throws IllegalArgumentException, IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public javax.ejb.Timer createTimer(Date initialExpiration, long intervalDuration, Serializable info)
+         throws IllegalArgumentException, IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   @Override
+   public Collection<javax.ejb.Timer> getTimers() throws IllegalStateException, EJBException
+   {
+      return null;
+   }
+
+   public Map<Method, ScheduleExpression> getAutoTimers()
+   {
+      return this.autoTimerInfo;
+   }
+   
+}

Deleted: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java
===================================================================
--- projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java	2010-09-23 15:54:35 UTC (rev 108299)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.timerservice.deployer.test.autotimer;
-
-import javax.ejb.Schedule;
-import javax.ejb.Stateless;
-import javax.ejb.Timer;
-
-/**
- * SimpleSLSB
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
- at Stateless
-public class SimpleSLSB
-{
-
-   @Schedule(hour = "*", minute = "*", second = "15")
-   public void autoTimerOne(Timer timer)
-   {
-
-   }
-}

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java)
===================================================================
--- projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java	                        (rev 0)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/SimpleSLSB.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.timerservice.deployer.test.autotimer;
+
+import javax.ejb.Schedule;
+import javax.ejb.Stateless;
+import javax.ejb.Timer;
+
+/**
+ * SimpleSLSB
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+public class SimpleSLSB
+{
+
+   @Schedule(hour = "*", minute = "*", second = "15")
+   public void autoTimerOne(Timer timer)
+   {
+
+   }
+}

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit)

Deleted: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java
===================================================================
--- projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java	2010-09-23 15:54:35 UTC (rev 108299)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.timerservice.deployer.test.autotimer.unit;
-
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import java.lang.reflect.AnnotatedElement;
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Map;
-
-import javax.ejb.ScheduleExpression;
-import javax.ejb.Timer;
-
-import junit.framework.Assert;
-
-import org.jboss.ejb3.EJBContainer;
-import org.jboss.ejb3.timerservice.deployer.AutoTimerInitializer;
-import org.jboss.ejb3.timerservice.deployer.test.autotimer.MockTimerService;
-import org.jboss.ejb3.timerservice.deployer.test.autotimer.SimpleSLSB;
-import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
-import org.jboss.metadata.annotation.finder.AnnotationFinder;
-import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
-import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
-import org.jboss.metadata.ejb.jboss.JBossMetaData;
-import org.junit.Test;
-
-/**
- * Tests for {@link AutoTimerInitializer}
- *
- * @author Jaikiran Pai
- * @version $Revision: $
- */
-public class AutoTimerInitializerTestCase
-{
-
-   /**
-    * Test that the {@link AutoTimerInitializer} creates auto-timers when the appropriate metadata
-    * is available in the {@link EJBContainer}s
-    * 
-    * @throws Exception
-    */
-   @Test
-   public void testAutoTimerCreation() throws Exception
-   {
-      EJBContainer mockContainer = mock(EJBContainer.class);
-      MockTimerService mockTimerService = new MockTimerService();
-      
-      JBossEnterpriseBeanMetaData beanMetaData = this.createMetadata(SimpleSLSB.class.getSimpleName(), SimpleSLSB.class);
-      ClassLoader tccl = Thread.currentThread().getContextClassLoader();
-      
-      // setup the mock(s)
-      when(mockContainer.getXml()).thenReturn(beanMetaData);
-      when(mockContainer.getTimerService()).thenReturn(mockTimerService);
-      doReturn(SimpleSLSB.class).when(mockContainer).getBeanClass();
-      when(mockContainer.getClassloader()).thenReturn(tccl);
-      
-      // initialize auto-timers for the container
-      AutoTimerInitializer autoTimerInitializer = new AutoTimerInitializer();
-      autoTimerInitializer.initializeAutoTimers(mockContainer);
-      
-      // get hold of the auto-timers that were created
-      Map<Method, ScheduleExpression> autoTimers = mockTimerService.getAutoTimers();
-      
-      // test
-      Assert.assertNotNull("No auto-timers were created", autoTimers);
-      Assert.assertEquals("Unexpected number of auto-timers were created", 1, autoTimers.size());
-      
-      // make sure the correct method was identified as an auto-timer method
-      Method expectedAutoTimerMethod = SimpleSLSB.class.getDeclaredMethod("autoTimerOne", new Class<?>[] {Timer.class});
-      Method autoTimerMethod = autoTimers.keySet().iterator().next();
-      Assert.assertEquals("Unexpected auto-timer method", expectedAutoTimerMethod, autoTimerMethod);
-      
-      // check the schedule expression used for creating the auto timer
-      ScheduleExpression expr = autoTimers.get(expectedAutoTimerMethod);
-      String hour = expr.getHour();
-      String minute = expr.getMinute();
-      String second = expr.getSecond();
-      Assert.assertEquals("Unexpected hour for auto-timer schedule", "*", hour);
-      Assert.assertEquals("Unexpected minute for auto-timer schedule", "*", minute);
-      Assert.assertEquals("Unexpected second for auto-timer schedule", "15", second);
-      
-   }
-   
-   /**
-    * Creates and returns the {@link JBossEnterpriseBeanMetaData} for the passed bean class
-    * 
-    * @param beanName The name of the EJB
-    * @param beanClass The EJB class
-    * @return
-    */
-   private JBossEnterpriseBeanMetaData createMetadata(String beanName, Class<?> beanClass)
-   {
-      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
-      JBoss50Creator creator = new JBoss50Creator(finder);
-      
-      Collection<Class<?>> classes = new HashSet<Class<?>>();
-      classes.add(beanClass);
-      JBossMetaData metadata = creator.create(classes);
-      
-      return metadata.getEnterpriseBean(beanName);
-      
-   }
-}

Copied: projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java (from rev 108299, projects/ejb3/trunk/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java)
===================================================================
--- projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java	                        (rev 0)
+++ projects/ejb3/branches/infinispan-int/timerservice-deployer/src/test/java/org/jboss/ejb3/timerservice/deployer/test/autotimer/unit/AutoTimerInitializerTestCase.java	2010-10-04 15:03:56 UTC (rev 108419)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.timerservice.deployer.test.autotimer.unit;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Map;
+
+import javax.ejb.ScheduleExpression;
+import javax.ejb.Timer;
+
+import junit.framework.Assert;
+
+import org.jboss.ejb3.EJBContainer;
+import org.jboss.ejb3.timerservice.deployer.AutoTimerInitializer;
+import org.jboss.ejb3.timerservice.deployer.test.autotimer.MockTimerService;
+import org.jboss.ejb3.timerservice.deployer.test.autotimer.SimpleSLSB;
+import org.jboss.metadata.annotation.creator.ejb.jboss.JBoss50Creator;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.annotation.finder.DefaultAnnotationFinder;
+import org.jboss.metadata.ejb.jboss.JBossEnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.jboss.JBossMetaData;
+import org.junit.Test;
+
+/**
+ * Tests for {@link AutoTimerInitializer}
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class AutoTimerInitializerTestCase
+{
+
+   /**
+    * Test that the {@link AutoTimerInitializer} creates auto-timers when the appropriate metadata
+    * is available in the {@link EJBContainer}s
+    * 
+    * @throws Exception
+    */
+   @Test
+   public void testAutoTimerCreation() throws Exception
+   {
+      EJBContainer mockContainer = mock(EJBContainer.class);
+      MockTimerService mockTimerService = new MockTimerService();
+      
+      JBossEnterpriseBeanMetaData beanMetaData = this.createMetadata(SimpleSLSB.class.getSimpleName(), SimpleSLSB.class);
+      ClassLoader tccl = Thread.currentThread().getContextClassLoader();
+      
+      // setup the mock(s)
+      when(mockContainer.getXml()).thenReturn(beanMetaData);
+      when(mockContainer.getTimerService()).thenReturn(mockTimerService);
+      doReturn(SimpleSLSB.class).when(mockContainer).getBeanClass();
+      when(mockContainer.getClassloader()).thenReturn(tccl);
+      
+      // initialize auto-timers for the container
+      AutoTimerInitializer autoTimerInitializer = new AutoTimerInitializer();
+      autoTimerInitializer.initializeAutoTimers(mockContainer);
+      
+      // get hold of the auto-timers that were created
+      Map<Method, ScheduleExpression> autoTimers = mockTimerService.getAutoTimers();
+      
+      // test
+      Assert.assertNotNull("No auto-timers were created", autoTimers);
+      Assert.assertEquals("Unexpected number of auto-timers were created", 1, autoTimers.size());
+      
+      // make sure the correct method was identified as an auto-timer method
+      Method expectedAutoTimerMethod = SimpleSLSB.class.getDeclaredMethod("autoTimerOne", new Class<?>[] {Timer.class});
+      Method autoTimerMethod = autoTimers.keySet().iterator().next();
+      Assert.assertEquals("Unexpected auto-timer method", expectedAutoTimerMethod, autoTimerMethod);
+      
+      // check the schedule expression used for creating the auto timer
+      ScheduleExpression expr = autoTimers.get(expectedAutoTimerMethod);
+      String hour = expr.getHour();
+      String minute = expr.getMinute();
+      String second = expr.getSecond();
+      Assert.assertEquals("Unexpected hour for auto-timer schedule", "*", hour);
+      Assert.assertEquals("Unexpected minute for auto-timer schedule", "*", minute);
+      Assert.assertEquals("Unexpected second for auto-timer schedule", "15", second);
+      
+   }
+   
+   /**
+    * Creates and returns the {@link JBossEnterpriseBeanMetaData} for the passed bean class
+    * 
+    * @param beanName The name of the EJB
+    * @param beanClass The EJB class
+    * @return
+    */
+   private JBossEnterpriseBeanMetaData createMetadata(String beanName, Class<?> beanClass)
+   {
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      
+      Collection<Class<?>> classes = new HashSet<Class<?>>();
+      classes.add(beanClass);
+      JBossMetaData metadata = creator.create(classes);
+      
+      return metadata.getEnterpriseBean(beanName);
+      
+   }
+}



More information about the jboss-cvs-commits mailing list