[jboss-cvs] JBossAS SVN: r105754 - in projects/metadata/ejb/trunk/src: main/java/org/jboss/metadata/annotation/creator/ejb/jboss and 6 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sun Jun 6 15:00:34 EDT 2010


Author: jaikiran
Date: 2010-06-06 15:00:33 -0400 (Sun, 06 Jun 2010)
New Revision: 105754

Added:
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SchedulesProcessor.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/MDBWithMultipleSchedules.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SLSBWithMultipleSchedules.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SingletonWithMultipleSchedules.java
   projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar-with-multiple-schedules.xml
Modified:
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/MessageDrivenProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ScheduleProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatelessProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/MessageDrivenProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/StatelessProcessor.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/common/ejb/IScheduleTarget.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMessageDrivenBean31MetaData.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBean31MetaData.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java
   projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java
   projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/unit/ScheduleTestCase.java
   projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar.xml
Log:
JBMETA-290 Added support for @Schedules and its xml counterpart

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/MessageDrivenProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/MessageDrivenProcessor.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/MessageDrivenProcessor.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -51,6 +51,8 @@
       
       // add @Schedule processor
       addMethodProcessor(new ScheduleProcessor(finder));
+      // add @Schedules processor
+      addMethodProcessor(new SchedulesProcessor(finder));
 
    }
 

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ScheduleProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ScheduleProcessor.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/ScheduleProcessor.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -95,7 +95,7 @@
       timerMetadata.setSchedule(scheduleMetadata);
 
       // finally set the timer metadata in the bean
-      scheduleTargetBeanMetaData.setTimer(timerMetadata);
+      scheduleTargetBeanMetaData.addTimer(timerMetadata);
    }
 
 }

Added: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SchedulesProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SchedulesProcessor.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SchedulesProcessor.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -0,0 +1,107 @@
+/*
+ * 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.metadata.annotation.creator.ejb;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.lang.reflect.Method;
+import java.util.Collection;
+
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+
+import org.jboss.metadata.annotation.creator.AbstractFinderUser;
+import org.jboss.metadata.annotation.creator.EjbProcessorUtils;
+import org.jboss.metadata.annotation.creator.Processor;
+import org.jboss.metadata.annotation.creator.ProcessorUtils;
+import org.jboss.metadata.annotation.finder.AnnotationFinder;
+import org.jboss.metadata.common.ejb.IScheduleTarget;
+import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
+import org.jboss.metadata.ejb.spec.ScheduleMetaData;
+import org.jboss.metadata.ejb.spec.TimerMetaData;
+
+/**
+ * SchedulesProcessor
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+public class SchedulesProcessor extends AbstractFinderUser implements Processor<IScheduleTarget, Method>
+{
+
+   /**
+    * 
+    * @param finder
+    */
+   public SchedulesProcessor(AnnotationFinder<AnnotatedElement> finder)
+   {
+      super(finder);
+      
+   }
+
+   @Override
+   public Collection<Class<? extends Annotation>> getAnnotationTypes()
+   {
+      return ProcessorUtils.createAnnotationSet(Schedules.class);
+   }
+
+   @Override
+   public void process(IScheduleTarget scheduleTargetBeanMetaData, Method method)
+   {
+      Schedules schedulesAnnotation = finder.getAnnotation(method, Schedules.class);
+      if(schedulesAnnotation == null)
+      {
+         return;
+      }
+      Schedule[] schedules = schedulesAnnotation.value();
+      if (schedules == null)
+      {
+         return;
+      }
+      // for each schedule, create a timer metadata and
+      // finally add it to the bean metadata's timer list
+      for (Schedule schedule : schedules)
+      {
+         // create timer metadata
+         TimerMetaData timerMetadata = new TimerMetaData();
+         timerMetadata.setInfo(schedule.info());
+         timerMetadata.setPersistent(schedule.persistent());
+         timerMetadata.setTimezone(schedule.timezone());
+   
+         // create a timeout method metadata for the method on which this
+         // @Schedule is present
+         NamedMethodMetaData timeoutMethod = new NamedMethodMetaData();
+         timeoutMethod.setMethodName(method.getName());
+         timeoutMethod.setMethodParams(EjbProcessorUtils.getMethodParameters(method));
+         timerMetadata.setTimeoutMethod(timeoutMethod);
+         
+         // create schedule metadata
+         ScheduleMetaData scheduleMetadata = new ScheduleMetaData(schedule);
+         timerMetadata.setSchedule(scheduleMetadata);
+   
+         // finally set the timer metadata in the bean
+         scheduleTargetBeanMetaData.addTimer(timerMetadata);
+      }
+      
+   }
+
+}

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/SingletonProcessor.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -61,6 +61,8 @@
       
       // add @Schedule processor
       addMethodProcessor(new ScheduleProcessor(finder));
+      // add @Schedules processor
+      addMethodProcessor(new SchedulesProcessor(finder));
 
    }
 

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatelessProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatelessProcessor.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/StatelessProcessor.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -46,6 +46,8 @@
 
       // add @Schedule processor
       addMethodProcessor(new ScheduleProcessor(finder));
+      // add @Schedules processor
+      addMethodProcessor(new SchedulesProcessor(finder));
    }
    
    public SessionBeanMetaData create(Class<?> beanClass)

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/MessageDrivenProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/MessageDrivenProcessor.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/MessageDrivenProcessor.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -30,6 +30,7 @@
 
 import org.jboss.metadata.annotation.creator.ProcessorUtils;
 import org.jboss.metadata.annotation.creator.ejb.ScheduleProcessor;
+import org.jboss.metadata.annotation.creator.ejb.SchedulesProcessor;
 import org.jboss.metadata.annotation.finder.AnnotationFinder;
 import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBean31MetaData;
 import org.jboss.metadata.ejb.jboss.JBossMessageDrivenBeanMetaData;
@@ -56,6 +57,8 @@
       addMethodProcessor(new TimeoutProcessor(finder));
       // add @Schedule processor
       addMethodProcessor(new ScheduleProcessor(finder));
+      // add @Schedules processor
+      addMethodProcessor(new SchedulesProcessor(finder));
 
    }
 

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/StatelessProcessor.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/StatelessProcessor.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/annotation/creator/ejb/jboss/StatelessProcessor.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -29,6 +29,7 @@
 
 import org.jboss.metadata.annotation.creator.ProcessorUtils;
 import org.jboss.metadata.annotation.creator.ejb.ScheduleProcessor;
+import org.jboss.metadata.annotation.creator.ejb.SchedulesProcessor;
 import org.jboss.metadata.annotation.finder.AnnotationFinder;
 import org.jboss.metadata.ejb.jboss.JBossSessionBeanMetaData;
 import org.jboss.metadata.ejb.spec.SessionType;
@@ -50,6 +51,8 @@
       
       // add @Schedule processor
       addMethodProcessor(new ScheduleProcessor(finder));
+      // add @Schedules processor
+      addMethodProcessor(new SchedulesProcessor(finder));
    }
 
    @Override

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/common/ejb/IScheduleTarget.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/common/ejb/IScheduleTarget.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/common/ejb/IScheduleTarget.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -21,6 +21,8 @@
  */
 package org.jboss.metadata.common.ejb;
 
+import java.util.List;
+
 import org.jboss.metadata.ejb.spec.TimerMetaData;
 
 /**
@@ -32,7 +34,9 @@
 public interface IScheduleTarget extends ITimeoutTarget
 {
 
-   TimerMetaData getTimer();
+   List<TimerMetaData> getTimers();
    
-   void setTimer(TimerMetaData timerMetaData);
+   void setTimers(List<TimerMetaData> timers);
+   
+   void addTimer(TimerMetaData timer);
 }

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMessageDrivenBean31MetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMessageDrivenBean31MetaData.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossMessageDrivenBean31MetaData.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -21,6 +21,9 @@
  */
 package org.jboss.metadata.ejb.jboss;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.ejb.Schedule;
 
 import org.jboss.metadata.common.ejb.IScheduleTarget;
@@ -41,26 +44,36 @@
    /**
     * Represents metadata for {@link Schedule}
     */
-   private TimerMetaData timer;
+   private List<TimerMetaData> timers = new ArrayList<TimerMetaData>();
    
    /**
     * Returns the {@link TimerMetaData} associated with this bean
     */
    @Override
-   public TimerMetaData getTimer()
+   public List<TimerMetaData> getTimers()
    {
-      return this.timer;
+      return this.timers;
    }
 
    /**
     * Sets the {@link TimerMetaData} for this bean
     */
    @Override
-   public void setTimer(TimerMetaData timerMetaData)
+   public void setTimers(List<TimerMetaData> timers)
    {
-      this.timer = timerMetaData;
+      this.timers = timers;
    }
    
+   @Override
+   public void addTimer(TimerMetaData timer)
+   {
+      if (this.timers == null)
+      {
+         this.timers = new ArrayList<TimerMetaData>();
+      }
+      this.timers.add(timer);
+   }
+   
    /**
     * {@inheritDoc}
     */
@@ -72,13 +85,21 @@
       JBossMessageDrivenBean31MetaData joverride = (JBossMessageDrivenBean31MetaData) override;
       MessageDrivenBean31MetaData soriginal = (MessageDrivenBean31MetaData) original;
       
-      if(joverride != null && joverride.timer != null)
+      if(joverride != null && joverride.timers != null)
       {
-         this.timer = joverride.timer;
+         if (this.timers == null)
+         {
+            this.timers = new ArrayList<TimerMetaData>();
+         }
+         this.timers.addAll(joverride.timers);
       }
-      else if (soriginal != null && soriginal.getTimer() != null)
+      else if (soriginal != null && soriginal.getTimers() != null)
       {
-         this.timer = soriginal.getTimer();
+         if (this.timers == null)
+         {
+            this.timers = new ArrayList<TimerMetaData>();
+         }
+         this.timers.addAll(soriginal.getTimers());
       }
 
    }
@@ -93,13 +114,21 @@
       JBossMessageDrivenBean31MetaData override = overrideEjb instanceof JBossGenericBeanMetaData ? null: (JBossMessageDrivenBean31MetaData) overrideEjb;
       JBossMessageDrivenBean31MetaData original = originalEjb instanceof JBossGenericBeanMetaData ? null: (JBossMessageDrivenBean31MetaData) originalEjb;
       
-      if(override != null && override.timer != null)
+      if(override != null && override.timers != null)
       {
-         this.timer = override.timer;
+         if (this.timers == null)
+         {
+            this.timers = new ArrayList<TimerMetaData>();
+         }
+         this.timers.addAll(override.timers);
       }
-      else if (original != null && original.timer != null)
+      else if (original != null && original.timers != null)
       {
-         this.timer = original.timer;
+         if (this.timers == null)
+         {
+            this.timers = new ArrayList<TimerMetaData>();
+         }
+         this.timers.addAll(original.timers);
       }
    }
  

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/jboss/JBossSessionBean31MetaData.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -21,8 +21,10 @@
  */
 package org.jboss.metadata.ejb.jboss;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -90,7 +92,7 @@
    /**
     * For beans which have auto-timers (ex: through use of {@link Schedule})
     */
-   private TimerMetaData timer;
+   private List<TimerMetaData> timers = new ArrayList<TimerMetaData>();
 
    public AsyncMethodsMetaData getAsyncMethods()
    {
@@ -294,20 +296,32 @@
    /**
     * Returns the {@link TimerMetaData} associated (if any) with this bean
     */
-   public TimerMetaData getTimer()
+   @Override
+   public List<TimerMetaData> getTimers()
    {
-      return this.timer;
+      return this.timers;
    }
    
    /**
     * Sets the {@link TimerMetaData} associated with this bean
     */
-   public void setTimer(TimerMetaData timer)
+   @Override
+   public void setTimers(List<TimerMetaData> timer)
    {
-      this.timer = timer;
+      this.timers = timer;
    }
    
    @Override
+   public void addTimer(TimerMetaData timer)
+   {
+      if (this.timers == null)
+      {
+         this.timers = new ArrayList<TimerMetaData>();
+      }
+      this.timers.add(timer);
+   }
+   
+   @Override
    public void merge(JBossEnterpriseBeanMetaData override, JBossEnterpriseBeanMetaData original)
    {
       super.merge(override, original);
@@ -350,9 +364,13 @@
          {
             this.dependsOn = joverride.dependsOn;
          }
-         if (joverride.timer != null)
+         if (joverride.timers != null)
          {
-            this.timer = joverride.timer;
+            if (this.timers == null)
+            {
+               this.timers = new ArrayList<TimerMetaData>();
+            }
+            this.timers.addAll(joverride.timers);
          }
       }
       else if (soriginal != null)
@@ -383,9 +401,13 @@
          {
             this.dependsOn = soriginal.dependsOn;
          }
-         if (soriginal.timer != null)
+         if (soriginal.timers != null)
          {
-            this.timer = soriginal.timer;
+            if (this.timers == null)
+            {
+               this.timers = new ArrayList<TimerMetaData>();
+            }
+            this.timers.addAll(soriginal.timers);
          }
       }
 
@@ -431,9 +453,13 @@
          {
             this.dependsOn = joverride.dependsOn;
          }
-         if (joverride.timer != null)
+         if (joverride.timers != null)
          {
-            this.timer = joverride.timer;
+            if (this.timers == null)
+            {
+               this.timers = new ArrayList<TimerMetaData>();
+            }
+            this.timers.addAll(joverride.timers);
          }
       }
       else if (soriginal != null)
@@ -464,9 +490,13 @@
          {
             this.dependsOn = soriginal.getDependsOn();
          }
-         if (soriginal.getTimer() != null)
+         if (soriginal.getTimers() != null)
          {
-            this.timer = soriginal.getTimer();
+            if (this.timers == null)
+            {
+               this.timers = new ArrayList<TimerMetaData>();
+            }
+            this.timers.addAll(soriginal.getTimers());
          }
       }
 

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBean31MetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBean31MetaData.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/MessageDrivenBean31MetaData.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -21,6 +21,9 @@
  */
 package org.jboss.metadata.ejb.spec;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import javax.ejb.Schedule;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlType;
@@ -39,7 +42,7 @@
 @XmlType(name="message-driven-beanType", propOrder={"descriptionGroup", "ejbName", "mappedName", "ejbClass",
       "transactionType", "messageSelector", "acknowledgeMode", "messageDrivenDestination", // <!-- these are ejb2.x
       "messagingType",
-      "timeoutMethod", "timer", "transactionType", "messageDestinationType", "messageDestinationLink", "activationConfig", "aroundInvokes",
+      "timeoutMethod", "timers", "transactionType", "messageDestinationType", "messageDestinationLink", "activationConfig", "aroundInvokes",
       "environmentRefsGroup", "securityIdentity"})
 @JBossXmlType(modelGroup=JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)      
 public class MessageDrivenBean31MetaData extends MessageDrivenBeanMetaData implements ITimeoutTarget, IScheduleTarget
@@ -48,15 +51,15 @@
    /**
     * Represents metadata for {@link Schedule}
     */
-   private TimerMetaData timer;
+   private List<TimerMetaData> timers = new ArrayList<TimerMetaData>();
    
    /**
     * Returns the {@link TimerMetaData} associated with this bean
     */
    @Override
-   public TimerMetaData getTimer()
+   public List<TimerMetaData> getTimers()
    {
-      return this.timer;
+      return this.timers;
    }
 
    /**
@@ -64,11 +67,21 @@
     */
    @Override
    @XmlElement (name = "timer", required = false)
-   public void setTimer(TimerMetaData timerMetaData)
+   public void setTimers(List<TimerMetaData> timers)
    {
-      this.timer = timerMetaData;
+      this.timers = timers;
    }
 
+   @Override
+   public void addTimer(TimerMetaData timer)
+   {
+      if (this.timers == null)
+      {
+         this.timers = new ArrayList<TimerMetaData>();
+      }
+      this.timers.add(timer);
+   }
+   
    /**
     * {@inheritDoc}
     */
@@ -80,13 +93,21 @@
       MessageDrivenBean31MetaData overrideMetaData = (MessageDrivenBean31MetaData) override;
       MessageDrivenBean31MetaData originalMetaData = (MessageDrivenBean31MetaData) original;
       
-      if (overrideMetaData != null && overrideMetaData.timer != null)
+      if (overrideMetaData != null && overrideMetaData.timers != null)
       {
-         this.timer = overrideMetaData.timer;
+         if (this.timers == null)
+         {
+            this.timers = new ArrayList<TimerMetaData>();
+         }
+         this.timers.addAll(overrideMetaData.timers);
       }
-      else if (originalMetaData != null && originalMetaData.timer != null)
+      else if (originalMetaData != null && originalMetaData.timers != null)
       {
-         this.timer = originalMetaData.timer;
+         if (this.timers == null)
+         {
+            this.timers = new ArrayList<TimerMetaData>();
+         }
+         this.timers.addAll(originalMetaData.timers);
       }
       
    }

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/SessionBean31MetaData.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -21,6 +21,7 @@
  */
 package org.jboss.metadata.ejb.spec;
 
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.List;
@@ -42,7 +43,7 @@
  */
 @XmlType(name = "session-beanType", propOrder =
 {"descriptionGroup", "ejbName", "mappedName", "home", "remote", "localHome", "local", "businessLocals",
-      "businessRemotes", "localBean", "serviceEndpoint", "ejbClass", "sessionType", "timeoutMethod", "timer", "initOnStartup",
+      "businessRemotes", "localBean", "serviceEndpoint", "ejbClass", "sessionType", "timeoutMethod", "timers", "initOnStartup",
       "concurrencyManagementType", "concurrentMethods", "dependsOnMetaData", "initMethods", "removeMethods", "asyncMethods", "transactionType",
       "aroundInvokes", "environmentRefsGroup", "postActivates", "prePassivates", "securityRoleRefs", "securityIdentity"})
 //@JBossXmlType(modelGroup = JBossXmlConstants.MODEL_GROUP_UNORDERED_SEQUENCE)
@@ -91,7 +92,7 @@
    /**
     * Represents the metadata for auto created timers
     */
-   private TimerMetaData timer;
+   private List<TimerMetaData> timers;
 
    /**
     * Returns the init-on-startup value of the session bean metadata.
@@ -323,16 +324,29 @@
       this.setDependsOn(dependsOn.toArray(new String[dependsOn.size()]));
    }
    
-   public TimerMetaData getTimer()
+   @Override
+   public List<TimerMetaData> getTimers()
    {
-      return this.timer;
+      return this.timers;
    }
    
    @XmlElement (name = "timer", required = false)
-   public void setTimer(TimerMetaData timer)
+   @Override
+   public void setTimers(List<TimerMetaData> timers)
    {
-      this.timer = timer;
+      this.timers = timers;
    }
+
+   @Override
+   public void addTimer(TimerMetaData timer)
+   {
+      if (this.timers == null)
+      {
+         this.timers = new ArrayList<TimerMetaData>();
+      }
+      this.timers.add(timer);
+   }
+
    
    /**
     * {@inheritDoc}
@@ -386,9 +400,13 @@
          {
             this.dependsOn = override.dependsOn;
          }
-         if (override.timer != null)
+         if (override.timers != null)
          {
-            this.timer = override.timer;
+            if (this.timers == null)
+            {
+               this.timers = new ArrayList<TimerMetaData>();
+            }
+            this.timers.addAll(override.timers);
          }
       }
       else if (original != null)
@@ -425,9 +443,13 @@
          {
             this.dependsOn = original.dependsOn;
          }
-         if (original.timer != null)
+         if (original.timers != null)
          {
-            this.timer = original.timer;
+            if (this.timers == null)
+            {
+               this.timers = new ArrayList<TimerMetaData>();
+            }
+            this.timers.addAll(original.timers);
          }
       }
    }

Modified: projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java
===================================================================
--- projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/main/java/org/jboss/metadata/ejb/spec/TimerMetaData.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -60,7 +60,7 @@
       return schedule;
    }
 
-   @XmlElement (name = "schedule", required = false)
+   @XmlElement (name = "schedule", required = true)
    public void setSchedule(ScheduleMetaData schedule)
    {
       this.schedule = schedule;

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/MDBWithMultipleSchedules.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/MDBWithMultipleSchedules.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/MDBWithMultipleSchedules.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -0,0 +1,46 @@
+/*
+ * 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.metadata.ejb.test.schedule;
+
+import javax.ejb.MessageDriven;
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import javax.ejb.Timer;
+
+/**
+ * MDBWithMultipleSchedules
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at MessageDriven
+public class MDBWithMultipleSchedules
+{
+   @Schedules ({
+      @Schedule (info = "1", minute = "*", dayOfMonth="1"),
+      @Schedule (info = "2", hour = "*")
+   })
+   public void someMethod(Timer timer)
+   {
+      
+   }
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SLSBWithMultipleSchedules.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SLSBWithMultipleSchedules.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SLSBWithMultipleSchedules.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -0,0 +1,45 @@
+/*
+ * 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.metadata.ejb.test.schedule;
+
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import javax.ejb.Stateless;
+import javax.ejb.Timer;
+
+/**
+ * SLSBWithMultipleSchedules
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Stateless
+public class SLSBWithMultipleSchedules
+{
+
+   @Schedules(
+   {@Schedule(info = "1", persistent = false), @Schedule(info = "2", timezone = "IST")})
+   public void schedule(Timer timer)
+   {
+
+   }
+}

Added: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SingletonWithMultipleSchedules.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SingletonWithMultipleSchedules.java	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/SingletonWithMultipleSchedules.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -0,0 +1,58 @@
+/*
+ * 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.metadata.ejb.test.schedule;
+
+import javax.ejb.Schedule;
+import javax.ejb.Schedules;
+import javax.ejb.Singleton;
+import javax.ejb.Timer;
+
+/**
+ * SingletonWithMultipleSchedules
+ *
+ * @author Jaikiran Pai
+ * @version $Revision: $
+ */
+ at Singleton
+public class SingletonWithMultipleSchedules
+{
+
+   @Schedules( {
+      @Schedule (info="1", timezone="CET"),
+      @Schedule (info="2"),
+      @Schedule (info = "3", dayOfMonth="24", persistent = false)
+   })
+   public void schedule(Timer timer)
+   {
+      
+   }
+   
+   
+   @Schedules( {
+      @Schedule (info="4", hour="*")
+   })
+   public void anotherSchedule(Timer timer)
+   {
+      
+   }
+
+}

Modified: projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/unit/ScheduleTestCase.java
===================================================================
--- projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/unit/ScheduleTestCase.java	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/test/java/org/jboss/metadata/ejb/test/schedule/unit/ScheduleTestCase.java	2010-06-06 19:00:33 UTC (rev 105754)
@@ -21,15 +21,16 @@
  */
 package org.jboss.metadata.ejb.test.schedule.unit;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.lang.reflect.AnnotatedElement;
 import java.net.URL;
 import java.util.Collection;
+import java.util.List;
 
 import javax.ejb.Schedule;
+import javax.ejb.Schedules;
 import javax.ejb.Timer;
 
 import junit.framework.Assert;
@@ -45,13 +46,17 @@
 import org.jboss.metadata.ejb.spec.EjbJar31MetaData;
 import org.jboss.metadata.ejb.spec.EjbJarMetaData;
 import org.jboss.metadata.ejb.spec.EnterpriseBeanMetaData;
+import org.jboss.metadata.ejb.spec.MessageDrivenBean31MetaData;
 import org.jboss.metadata.ejb.spec.MethodParametersMetaData;
 import org.jboss.metadata.ejb.spec.NamedMethodMetaData;
 import org.jboss.metadata.ejb.spec.ScheduleMetaData;
 import org.jboss.metadata.ejb.spec.SessionBean31MetaData;
 import org.jboss.metadata.ejb.spec.TimerMetaData;
+import org.jboss.metadata.ejb.test.schedule.MDBWithMultipleSchedules;
 import org.jboss.metadata.ejb.test.schedule.MDBWithSchedule;
+import org.jboss.metadata.ejb.test.schedule.SLSBWithMultipleSchedules;
 import org.jboss.metadata.ejb.test.schedule.SimpleSLSBWithSchedule;
+import org.jboss.metadata.ejb.test.schedule.SingletonWithMultipleSchedules;
 import org.jboss.metadata.ejb.test.schedule.SingletonWithSchedule;
 import org.jboss.test.metadata.common.PackageScanner;
 import org.jboss.test.metadata.common.ScanPackage;
@@ -64,7 +69,8 @@
 import org.junit.Test;
 
 /**
- * ScheduleTestCase
+ * Tests that the processing of {@link Schedule} and {@link Schedules} annotations and their
+ * xml equivalents on beans is processed correctly, for metadata.
  *
  * @author Jaikiran Pai
  * @version $Revision: $
@@ -107,11 +113,14 @@
             (enterpriseBean instanceof JBossSessionBean31MetaData));
       JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) enterpriseBean;
 
-      // get timer metadata
-      TimerMetaData timerMetaData = sessionBean.getTimer();
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
 
       // check the metadata for validity
-      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timerMetaData);
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 1, timers.size());
+
+      TimerMetaData timerMetaData = timers.get(0);
       Assert.assertTrue("Info object was expected to be empty", timerMetaData.getInfo().isEmpty());
       Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
 
@@ -124,7 +133,7 @@
       Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
       Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
       Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
-      
+
       // test the timeout method
       NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
       Assert.assertNotNull("Timeout method is null", timeoutMethod);
@@ -135,7 +144,6 @@
       String timeoutMethodParam = timeoutMethodParams.get(0);
       Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
 
-
    }
 
    /**
@@ -157,11 +165,14 @@
             (enterpriseBean instanceof JBossMessageDrivenBean31MetaData));
       JBossMessageDrivenBean31MetaData mdb = (JBossMessageDrivenBean31MetaData) enterpriseBean;
 
-      // get timer metadata
-      TimerMetaData timerMetaData = mdb.getTimer();
+      // get the timers
+      List<TimerMetaData> timers = mdb.getTimers();
 
       // check the metadata for validity
-      Assert.assertNotNull("Timer metadata not found on bean " + mdb.getName(), timerMetaData);
+      Assert.assertNotNull("Timer metadata not found on bean " + mdb.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + mdb.getName(), 1, timers.size());
+
+      TimerMetaData timerMetaData = timers.get(0);
       Assert.assertTrue("Info object was expected to be empty", timerMetaData.getInfo().isEmpty());
       Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
 
@@ -174,7 +185,7 @@
       Assert.assertEquals("Unexpected day of month in schedule", "1", schedule.getDayOfMonth());
       Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
       Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
-      
+
       // test the timeout method
       NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
       Assert.assertNotNull("Timeout method is null", timeoutMethod);
@@ -209,11 +220,14 @@
       JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) enterpriseBean;
       Assert.assertTrue(sessionBean.getName() + " is not a singleton", sessionBean.isSingleton());
 
-      // get timer metadata
-      TimerMetaData timerMetaData = sessionBean.getTimer();
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
 
       // check the metadata for validity
-      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timerMetaData);
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 1, timers.size());
+
+      TimerMetaData timerMetaData = timers.get(0);
       Assert.assertEquals("Unexpected info on timer metadata", SingletonWithSchedule.INFO_FOR_SCHEDULE, timerMetaData
             .getInfo());
       Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
@@ -228,7 +242,7 @@
       Assert.assertEquals("Unexpected day of month in schedule", "12", schedule.getDayOfMonth());
       Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
       Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
-      
+
       // test the timeout method
       NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
       Assert.assertNotNull("Timeout method is null", timeoutMethod);
@@ -254,11 +268,14 @@
             (enterpriseBean instanceof SessionBean31MetaData));
       SessionBean31MetaData sessionBean = (SessionBean31MetaData) enterpriseBean;
 
-      // get the timer metadata
-      TimerMetaData timerMetaData = sessionBean.getTimer();
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
 
       // check the metadata for validity
-      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timerMetaData);
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 1, timers.size());
+
+      TimerMetaData timerMetaData = timers.get(0);
       Assert.assertNull("Unexpected info on timer metadata", timerMetaData.getInfo());
       Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
 
@@ -271,7 +288,7 @@
       Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
       Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
       Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
-      
+
       // test the timeout method
       NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
       Assert.assertNotNull("Timeout method is null", timeoutMethod);
@@ -285,6 +302,583 @@
    }
 
    /**
+    * Tests that a MDB configured for timer through ejb-jar.xml is processed correctly for metadata
+    */
+   @Test
+   public void testScheduleForMDBInEjbJarXml() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class, "/org/jboss/metadata/ejb/test/schedule/ejb-jar.xml");
+      assertNotNull(jarMetaData);
+
+      EnterpriseBeanMetaData enterpriseBean = jarMetaData.getEnterpriseBean("MDBInEjbJarXml");
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + MessageDrivenBean31MetaData.class,
+            (enterpriseBean instanceof MessageDrivenBean31MetaData));
+      MessageDrivenBean31MetaData mdb = (MessageDrivenBean31MetaData) enterpriseBean;
+
+      // get the timers
+      List<TimerMetaData> timers = mdb.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + mdb.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + mdb.getName(), 1, timers.size());
+
+      TimerMetaData timerMetaData = timers.get(0);
+      Assert.assertEquals("Unexpected info on timer metadata", "SomeInfoInXml", timerMetaData.getInfo());
+      Assert.assertFalse("Timer was expected to be persistent", timerMetaData.isPersistent());
+
+      // get hold of the schedule and validate it
+      ScheduleMetaData schedule = timerMetaData.getSchedule();
+      Assert.assertEquals("Unexpected seconds in schedule", "5", schedule.getSecond());
+      Assert.assertEquals("Unexpected minutes in schedule", "4", schedule.getMinute());
+      Assert.assertEquals("Unexpected hours in schedule", "3", schedule.getHour());
+      Assert.assertEquals("Unexpected day of week in schedule", "2", schedule.getDayOfWeek());
+      Assert.assertEquals("Unexpected day of month in schedule", "1", schedule.getDayOfMonth());
+      Assert.assertEquals("Unexpected month in schedule", "Jan", schedule.getMonth());
+      Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+
+      // test the timeout method
+      NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+      Assert.assertNotNull("Timeout method is null", timeoutMethod);
+      Assert.assertEquals("Unexpected timeout method", "dummyMDBMethod", timeoutMethod.getMethodName());
+      MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+      Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+      Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+      String timeoutMethodParam = timeoutMethodParams.get(0);
+      Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+   }
+
+   /**
+    * Tests that a Singleton bean configured for timer through ejb-jar.xml is processed correctly for metadata
+    */
+   @Test
+   public void testScheduleForSingletonInEjbJarXml() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class, "/org/jboss/metadata/ejb/test/schedule/ejb-jar.xml");
+      assertNotNull(jarMetaData);
+
+      EnterpriseBeanMetaData enterpriseBean = jarMetaData.getEnterpriseBean("SingletonInEjbJarXml");
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + SessionBean31MetaData.class,
+            (enterpriseBean instanceof SessionBean31MetaData));
+      SessionBean31MetaData sessionBean = (SessionBean31MetaData) enterpriseBean;
+      Assert.assertTrue(sessionBean.getName() + " was not considered a singleton bean", sessionBean.isSingleton());
+
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 1, timers.size());
+
+      TimerMetaData timerMetaData = timers.get(0);
+      Assert.assertNull("Unexpected info on timer metadata", timerMetaData.getInfo());
+      Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+
+      // get hold of the schedule and validate it
+      ScheduleMetaData schedule = timerMetaData.getSchedule();
+      Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+      Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+      Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+      Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+      Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+      Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+      Assert.assertEquals("Unexpected year in schedule", "2009", schedule.getYear());
+
+      // test the timeout method
+      NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+      Assert.assertNotNull("Timeout method is null", timeoutMethod);
+      Assert.assertEquals("Unexpected timeout method", "dummySingletonMethod", timeoutMethod.getMethodName());
+      MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+      Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+      Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+      String timeoutMethodParam = timeoutMethodParams.get(0);
+      Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+   }
+
+   /**
+    * Tests that a Singleton bean which has methods marked with {@link Schedules} is
+    * processed correctly for metadata
+    */
+   @Test
+   @ScanPackage("org.jboss.metadata.ejb.test.schedule")
+   public void testMultipleSchedulesOnSingleton()
+   {
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      JBossMetaData metaData = creator.create(classes);
+      assertNotNull("Metadata not created", metaData);
+
+      // get hold of the bean
+      JBossEnterpriseBeanMetaData enterpriseBean = metaData.getEnterpriseBean(SingletonWithMultipleSchedules.class
+            .getSimpleName());
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + JBossSessionBean31MetaData.class,
+            (enterpriseBean instanceof JBossSessionBean31MetaData));
+      JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) enterpriseBean;
+      Assert.assertTrue(sessionBean.getName() + " is not a singleton", sessionBean.isSingleton());
+
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 4, timers.size());
+
+      for (int i = 0; i < timers.size(); i++)
+      {
+         TimerMetaData timerMetaData = timers.get(i);
+         String info = timerMetaData.getInfo();
+         Assert.assertNotNull("Info not present on timer metadata", timerMetaData.getInfo());
+
+         int infoVal = Integer.parseInt(info);
+
+         NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+         Assert.assertNotNull("Timeout method not present on timer metadata", timeoutMethod);
+         MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+         Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+         Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+         String timeoutMethodParam = timeoutMethodParams.get(0);
+         Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+         String timeoutMethodName = timeoutMethod.getMethodName();
+         ScheduleMetaData schedule = timerMetaData.getSchedule();
+         switch (infoVal)
+         {
+            case 1 :
+               Assert.assertEquals("Unexpected timeout method", "schedule", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+               Assert.assertEquals("Unexpected timezone on timer metadata", "CET", timerMetaData.getTimezone());
+               break;
+            case 2 :
+               Assert.assertEquals("Unexpected timeout method", "schedule", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+
+               break;
+            case 3 :
+               Assert.assertEquals("Unexpected timeout method", "schedule", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "24", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertFalse("Timer was *not* expected to be persistent", timerMetaData.isPersistent());
+
+               break;
+            case 4 :
+               Assert.assertEquals("Unexpected timeout method", "anotherSchedule", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "*", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               break;
+            default :
+               Assert.fail("Unexpected info " + info + " on timer metadata");
+         }
+      }
+
+   }
+
+   /**
+    * Tests that a SLSB which has methods marked with {@link Schedules} is
+    * processed correctly for metadata
+    */
+   @Test
+   @ScanPackage("org.jboss.metadata.ejb.test.schedule")
+   public void testMultipleSchedulesOnSLSB()
+   {
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      JBossMetaData metaData = creator.create(classes);
+      assertNotNull("Metadata not created", metaData);
+
+      // get hold of the bean
+      JBossEnterpriseBeanMetaData enterpriseBean = metaData.getEnterpriseBean(SLSBWithMultipleSchedules.class
+            .getSimpleName());
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + JBossSessionBean31MetaData.class,
+            (enterpriseBean instanceof JBossSessionBean31MetaData));
+      JBossSessionBean31MetaData sessionBean = (JBossSessionBean31MetaData) enterpriseBean;
+
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 2, timers.size());
+
+      for (int i = 0; i < timers.size(); i++)
+      {
+         TimerMetaData timerMetaData = timers.get(i);
+         String info = timerMetaData.getInfo();
+         Assert.assertNotNull("Info not present on timer metadata", timerMetaData.getInfo());
+
+         int infoVal = Integer.parseInt(info);
+
+         NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+         Assert.assertNotNull("Timeout method not present on timer metadata", timeoutMethod);
+         MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+         Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+         Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+         String timeoutMethodParam = timeoutMethodParams.get(0);
+         Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+         String timeoutMethodName = timeoutMethod.getMethodName();
+         ScheduleMetaData schedule = timerMetaData.getSchedule();
+         switch (infoVal)
+         {
+            case 1 :
+               Assert.assertEquals("Unexpected timeout method", "schedule", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertFalse("Timer was *not* expected to be persistent", timerMetaData.isPersistent());
+               break;
+            case 2 :
+               Assert.assertEquals("Unexpected timeout method", "schedule", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+               Assert.assertEquals("Unexpected timezone on timer metadata", "IST", timerMetaData.getTimezone());
+               break;
+            default :
+               Assert.fail("Unexpected info " + info + " on timer metadata");
+         }
+      }
+
+   }
+
+   /**
+    * Tests that a MDB which has methods marked with {@link Schedules} is
+    * processed correctly for metadata
+    */
+   @Test
+   @ScanPackage("org.jboss.metadata.ejb.test.schedule")
+   public void testMultipleSchedulesOnMDB()
+   {
+      AnnotationFinder<AnnotatedElement> finder = new DefaultAnnotationFinder<AnnotatedElement>();
+      JBoss50Creator creator = new JBoss50Creator(finder);
+      Collection<Class<?>> classes = PackageScanner.loadClasses();
+      JBossMetaData metaData = creator.create(classes);
+      assertNotNull("Metadata not created", metaData);
+
+      // get hold of the bean
+      JBossEnterpriseBeanMetaData enterpriseBean = metaData.getEnterpriseBean(MDBWithMultipleSchedules.class
+            .getSimpleName());
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + JBossMessageDrivenBean31MetaData.class,
+            (enterpriseBean instanceof JBossMessageDrivenBean31MetaData));
+      JBossMessageDrivenBean31MetaData mdb = (JBossMessageDrivenBean31MetaData) enterpriseBean;
+
+      // get the timers
+      List<TimerMetaData> timers = mdb.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + mdb.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + mdb.getName(), 2, timers.size());
+
+      for (int i = 0; i < timers.size(); i++)
+      {
+         TimerMetaData timerMetaData = timers.get(i);
+         String info = timerMetaData.getInfo();
+         Assert.assertNotNull("Info not present on timer metadata", timerMetaData.getInfo());
+
+         int infoVal = Integer.parseInt(info);
+
+         NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+         Assert.assertNotNull("Timeout method not present on timer metadata", timeoutMethod);
+         MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+         Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+         Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+         String timeoutMethodParam = timeoutMethodParams.get(0);
+         Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+         String timeoutMethodName = timeoutMethod.getMethodName();
+         ScheduleMetaData schedule = timerMetaData.getSchedule();
+         switch (infoVal)
+         {
+            case 1 :
+               Assert.assertEquals("Unexpected timeout method", "someMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "*", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "1", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+               break;
+            case 2 :
+               Assert.assertEquals("Unexpected timeout method", "someMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "*", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+               break;
+            default :
+               Assert.fail("Unexpected info " + info + " on timer metadata");
+         }
+      }
+
+   }
+
+   /**
+    * Tests that a Singleton bean which has methods marked as auto timeout methods in ejb-jar.xml
+    * is processed correctly for metadata
+    */
+   @Test
+   public void testMultipleSchedulesOnSingletonInEjbJarXML() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class,
+            "/org/jboss/metadata/ejb/test/schedule/ejb-jar-with-multiple-schedules.xml");
+      assertNotNull(jarMetaData);
+
+      EnterpriseBeanMetaData enterpriseBean = jarMetaData
+            .getEnterpriseBean("SingletonWithMultipleSchedulesInEjbJarXml");
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + SessionBean31MetaData.class,
+            (enterpriseBean instanceof SessionBean31MetaData));
+      SessionBean31MetaData sessionBean = (SessionBean31MetaData) enterpriseBean;
+      Assert.assertTrue(sessionBean.getName() + " was not considered a singleton bean", sessionBean.isSingleton());
+
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 2, timers.size());
+
+      for (int i = 0; i < timers.size(); i++)
+      {
+         TimerMetaData timerMetaData = timers.get(i);
+         String info = timerMetaData.getInfo();
+         Assert.assertNotNull("Info not present on timer metadata", timerMetaData.getInfo());
+
+         int infoVal = Integer.parseInt(info);
+
+         NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+         Assert.assertNotNull("Timeout method not present on timer metadata", timeoutMethod);
+         MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+         Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+         Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+         String timeoutMethodParam = timeoutMethodParams.get(0);
+         Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+         String timeoutMethodName = timeoutMethod.getMethodName();
+         ScheduleMetaData schedule = timerMetaData.getSchedule();
+         switch (infoVal)
+         {
+            case 1 :
+               Assert.assertEquals("Unexpected timeout method", "dummySingletonMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+               break;
+            case 2 :
+               Assert.assertEquals("Unexpected timeout method", "dummySingletonMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "2010", schedule.getYear());
+               Assert.assertFalse("Timer was *not* expected to be persistent", timerMetaData.isPersistent());
+
+               break;
+
+            default :
+               Assert.fail("Unexpected info " + info + " on timer metadata");
+         }
+      }
+
+   }
+
+   /**
+    * Tests that a MDB which has methods marked as auto timeout methods in ejb-jar.xml
+    * is processed correctly for metadata
+    */
+   @Test
+   public void testMultipleSchedulesOnMDBInEjbJarXML() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class,
+            "/org/jboss/metadata/ejb/test/schedule/ejb-jar-with-multiple-schedules.xml");
+      assertNotNull(jarMetaData);
+
+      EnterpriseBeanMetaData enterpriseBean = jarMetaData
+            .getEnterpriseBean("MDBWithMultipleSchedulesInEjbJarXml");
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + MessageDrivenBean31MetaData.class,
+            (enterpriseBean instanceof MessageDrivenBean31MetaData));
+      MessageDrivenBean31MetaData mdb = (MessageDrivenBean31MetaData) enterpriseBean;
+
+      // get the timers
+      List<TimerMetaData> timers = mdb.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + mdb.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + mdb.getName(), 2, timers.size());
+
+      for (int i = 0; i < timers.size(); i++)
+      {
+         TimerMetaData timerMetaData = timers.get(i);
+         String info = timerMetaData.getInfo();
+         Assert.assertNotNull("Info not present on timer metadata", timerMetaData.getInfo());
+
+         int infoVal = Integer.parseInt(info);
+
+         NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+         Assert.assertNotNull("Timeout method not present on timer metadata", timeoutMethod);
+         MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+         Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+         Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+         String timeoutMethodParam = timeoutMethodParams.get(0);
+         Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+         String timeoutMethodName = timeoutMethod.getMethodName();
+         ScheduleMetaData schedule = timerMetaData.getSchedule();
+         switch (infoVal)
+         {
+            case 1 :
+               Assert.assertEquals("Unexpected timeout method", "dummyMDBMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "5", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "4", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "3", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "2", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "1", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "Mar", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertFalse("Timer was *not* expected to be persistent", timerMetaData.isPersistent());
+               break;
+            case 2 :
+               Assert.assertEquals("Unexpected timeout method", "dummyMDBMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertFalse("Timer was *not* expected to be persistent", timerMetaData.isPersistent());
+               Assert.assertEquals("Unexpected timezone on timer metadata", "CET", timerMetaData.getTimezone());
+               break;
+
+            default :
+               Assert.fail("Unexpected info " + info + " on timer metadata");
+         }
+      }
+
+   }
+
+   /**
+    * Tests that a SLSB which has methods marked as auto timeout methods in ejb-jar.xml
+    * is processed correctly for metadata
+    */
+   @Test
+   public void testMultipleSchedulesOnSLSBInEjbJarXML() throws Exception
+   {
+      EjbJarMetaData jarMetaData = unmarshal(EjbJarMetaData.class,
+            "/org/jboss/metadata/ejb/test/schedule/ejb-jar-with-multiple-schedules.xml");
+      assertNotNull(jarMetaData);
+
+      EnterpriseBeanMetaData enterpriseBean = jarMetaData.getEnterpriseBean("MultipleScheduleSLSBInEjbJarXML");
+      assertTrue("metadata " + enterpriseBean.getClass() + " is not of type " + SessionBean31MetaData.class,
+            (enterpriseBean instanceof SessionBean31MetaData));
+      SessionBean31MetaData sessionBean = (SessionBean31MetaData) enterpriseBean;
+
+      // get the timers
+      List<TimerMetaData> timers = sessionBean.getTimers();
+
+      // check the metadata for validity
+      Assert.assertNotNull("Timer metadata not found on bean " + sessionBean.getName(), timers);
+      Assert.assertEquals("Unexpected number of timers found on bean " + sessionBean.getName(), 2, timers.size());
+
+      for (int i = 0; i < timers.size(); i++)
+      {
+         TimerMetaData timerMetaData = timers.get(i);
+         String info = timerMetaData.getInfo();
+         Assert.assertNotNull("Info not present on timer metadata", timerMetaData.getInfo());
+
+         int infoVal = Integer.parseInt(info);
+
+         NamedMethodMetaData timeoutMethod = timerMetaData.getTimeoutMethod();
+         Assert.assertNotNull("Timeout method not present on timer metadata", timeoutMethod);
+         MethodParametersMetaData timeoutMethodParams = timeoutMethod.getMethodParams();
+         Assert.assertNotNull("Timeout method params are null", timeoutMethodParams);
+         Assert.assertEquals("Unexpected number of method params for timeout method", 1, timeoutMethodParams.size());
+         String timeoutMethodParam = timeoutMethodParams.get(0);
+         Assert.assertEquals("Unexpected method param for timeout method", Timer.class.getName(), timeoutMethodParam);
+
+         String timeoutMethodName = timeoutMethod.getMethodName();
+         ScheduleMetaData schedule = timerMetaData.getSchedule();
+         switch (infoVal)
+         {
+            case 1 :
+               Assert.assertEquals("Unexpected timeout method", "dummySLSBMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "Wed", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "1", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+               break;
+            case 2 :
+               Assert.assertEquals("Unexpected timeout method", "anotherDummyMethod", timeoutMethodName);
+               Assert.assertEquals("Unexpected seconds in schedule", "0", schedule.getSecond());
+               Assert.assertEquals("Unexpected minutes in schedule", "0", schedule.getMinute());
+               Assert.assertEquals("Unexpected hours in schedule", "0", schedule.getHour());
+               Assert.assertEquals("Unexpected day of week in schedule", "*", schedule.getDayOfWeek());
+               Assert.assertEquals("Unexpected day of month in schedule", "*", schedule.getDayOfMonth());
+               Assert.assertEquals("Unexpected month in schedule", "*", schedule.getMonth());
+               Assert.assertEquals("Unexpected year in schedule", "*", schedule.getYear());
+               Assert.assertTrue("Timer was expected to be persistent", timerMetaData.isPersistent());
+
+               break;
+
+            default :
+               Assert.fail("Unexpected info " + info + " on timer metadata");
+         }
+      }
+
+   }
+
+   /**
     * Utility method
     * @param <T>
     * @param type

Added: projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar-with-multiple-schedules.xml
===================================================================
--- projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar-with-multiple-schedules.xml	                        (rev 0)
+++ projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar-with-multiple-schedules.xml	2010-06-06 19:00:33 UTC (rev 105754)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+      	  http://java.sun.com/xml/ns/javaee/ejb-jar_3_1.xsd"
+	version="3.1">
+
+	<enterprise-beans>
+		<session>
+			<ejb-name>MultipleScheduleSLSBInEjbJarXML</ejb-name>
+			<ejb-class>dummy</ejb-class>
+			<timer>
+				<schedule>
+					<day-of-month>1</day-of-month>
+					<day-of-week>Wed</day-of-week>
+				</schedule>
+				<timeout-method>
+					<method-name>dummySLSBMethod</method-name>
+					<method-params>
+						<method-param>javax.ejb.Timer</method-param>
+					</method-params>
+				</timeout-method>
+				<persistent>true</persistent>
+				<info>1</info>
+
+			</timer>
+			<timer>
+				<schedule>
+				</schedule>
+				<timeout-method>
+					<method-name>anotherDummyMethod</method-name>
+					<method-params>
+						<method-param>javax.ejb.Timer</method-param>
+					</method-params>
+				</timeout-method>
+				<persistent>true</persistent>
+				<info>2</info>
+
+			</timer>
+
+		</session>
+
+		<session>
+			<ejb-name>SingletonWithMultipleSchedulesInEjbJarXml</ejb-name>
+			<ejb-class>dummy</ejb-class>
+			<session-type>Singleton</session-type>
+			<timer>
+				<schedule></schedule>
+				<timeout-method>
+					<method-name>dummySingletonMethod</method-name>
+					<method-params>
+						<method-param>javax.ejb.Timer</method-param>
+					</method-params>
+				</timeout-method>
+				<info>1</info>
+			</timer>
+			<timer>
+				<schedule>
+					<year>2010</year>
+				</schedule>
+				<timeout-method>
+					<method-name>dummySingletonMethod</method-name>
+					<method-params>
+						<method-param>javax.ejb.Timer</method-param>
+					</method-params>
+				</timeout-method>
+				<persistent>false</persistent>
+				<info>2</info>
+			</timer>
+
+		</session>
+
+		<message-driven>
+			<ejb-name>MDBWithMultipleSchedulesInEjbJarXml</ejb-name>
+			<ejb-class>dummy</ejb-class>
+			<timer>
+				<schedule>
+					<second>5</second>
+					<minute>4</minute>
+					<hour>3</hour>
+					<day-of-month>1</day-of-month>
+					<month>Mar</month>
+					<day-of-week>2</day-of-week>
+					<year>*</year>
+				</schedule>
+				<timeout-method>
+					<method-name>dummyMDBMethod</method-name>
+					<method-params>
+						<method-param>javax.ejb.Timer</method-param>
+					</method-params>
+				</timeout-method>
+				<persistent>false</persistent>
+				<info>1</info>
+
+			</timer>
+			<timer>
+				<schedule></schedule>
+				<timeout-method>
+					<method-name>dummyMDBMethod</method-name>
+					<method-params>
+						<method-param>javax.ejb.Timer</method-param>
+					</method-params>
+				</timeout-method>
+				<persistent>false</persistent>
+				<timezone>CET</timezone>
+				<info>2</info>
+
+			</timer>
+		</message-driven>
+	</enterprise-beans>
+</ejb-jar>      
\ No newline at end of file

Modified: projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar.xml
===================================================================
--- projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar.xml	2010-06-06 17:50:48 UTC (rev 105753)
+++ projects/metadata/ejb/trunk/src/test/resources/org/jboss/metadata/ejb/test/schedule/ejb-jar.xml	2010-06-06 19:00:33 UTC (rev 105754)
@@ -26,6 +26,7 @@
 		<session>
 			<ejb-name>SingletonInEjbJarXml</ejb-name>
 			<ejb-class>dummy</ejb-class>
+			<session-type>Singleton</session-type>
 			<timer>
 				<schedule>
 					<year>2009</year>



More information about the jboss-cvs-commits mailing list