[jboss-svn-commits] JBL Code SVN: r23680 - in labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta: tests/src/org/jboss/soa/esb/schedule/JBESB_2146 and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Nov 3 14:08:22 EST 2008


Author: kevin.conner at jboss.com
Date: 2008-11-03 14:08:22 -0500 (Mon, 03 Nov 2008)
New Revision: 23680

Added:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java
Removed:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitXTestX.java
Modified:
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java
   labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml
Log:
Fix cron misfire instruction: JBESB-2146

Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java	2008-11-03 16:29:57 UTC (rev 23679)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/src/org/jboss/soa/esb/schedule/SchedulerJob.java	2008-11-03 19:08:22 UTC (rev 23680)
@@ -239,15 +239,11 @@
         throws ParseException
     {
         final CronTrigger trigger = new CronTrigger(getJobName(), JOB_GROUP, cronExpression) ;
-        trigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_DO_NOTHING) ;
+        trigger.setMisfireInstruction(CronTrigger.MISFIRE_INSTRUCTION_FIRE_ONCE_NOW) ;
         if (startDate != null)
         {
             trigger.setStartTime(startDate) ;
         }
-        else
-        {
-            trigger.setStartTime(new Date(0)) ;
-        }
         if (endDate != null)
         {
             trigger.setEndTime(endDate) ;

Copied: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java (from rev 23655, labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitXTestX.java)
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java	                        (rev 0)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitTest.java	2008-11-03 19:08:22 UTC (rev 23680)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * 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,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA  02110-1301, USA.
+ *
+ * (C) 2005-2006, JBoss Inc.
+ */
+package org.jboss.soa.esb.schedule.JBESB_2146;
+
+import junit.framework.TestCase;
+
+import org.jboss.soa.esb.mock.MockAction;
+import org.jboss.soa.esb.schedule.MockScheduledEventListener;
+import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
+import org.jboss.soa.esb.testutils.ESBConfigUtil;
+
+/**
+ *
+ * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
+ */
+public class JBESB_2146_UnitTest extends TestCase {
+
+    protected void setUp() throws Exception {
+        MockScheduledEventMessageComposer.reset();
+        MockScheduledEventListener.reset();
+        MockAction.message = null;
+    }
+
+    public void test_simple_schedule_01() throws Exception {
+        runTestConfig("config-01.xml", 10000);
+
+        JBESB_2146_ScheduledEventMessageComposer composer1 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener1");
+        JBESB_2146_ScheduledEventMessageComposer composer2 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener2");
+
+        assertTrue("simple-schedule-listener1 fired", composer1.composedMessages.size() > 0);
+        assertTrue("simple-schedule-listener2 fired", composer2.composedMessages.size() > 0);
+    }
+
+    private void runTestConfig(String configName, long upTime) throws Exception {
+        ESBConfigUtil configUtil = new ESBConfigUtil(getClass().getResourceAsStream(configName));
+
+        configUtil.startController();
+        Thread.sleep(upTime);
+        configUtil.stopController();
+    }
+}
\ No newline at end of file

Deleted: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitXTestX.java
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitXTestX.java	2008-11-03 16:29:57 UTC (rev 23679)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/JBESB_2146_UnitXTestX.java	2008-11-03 19:08:22 UTC (rev 23680)
@@ -1,73 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2006, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * 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,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA  02110-1301, USA.
- *
- * (C) 2005-2006, JBoss Inc.
- */
-package org.jboss.soa.esb.schedule.JBESB_2146;
-
-import junit.framework.TestCase;
-import org.jboss.soa.esb.testutils.ESBConfigUtil;
-import org.jboss.soa.esb.testutils.StringUtils;
-import org.jboss.soa.esb.parameters.ParamRepositoryException;
-import org.jboss.soa.esb.ConfigurationException;
-import org.jboss.soa.esb.schedule.MockScheduledEventMessageComposer;
-import org.jboss.soa.esb.schedule.MockScheduledEventListener;
-import org.jboss.soa.esb.mock.MockAction;
-import org.jboss.soa.esb.listeners.lifecycle.ManagedLifecycleException;
-import org.jboss.internal.soa.esb.util.StreamUtils;
-import org.xml.sax.SAXException;
-
-import java.io.UnsupportedEncodingException;
-import java.io.IOException;
-
-import javax.xml.parsers.ParserConfigurationException;
-
-/**
- *
- * @author <a href="mailto:tom.fennelly at jboss.com">tom.fennelly at jboss.com</a>
- */
-public class JBESB_2146_UnitXTestX extends TestCase {
-
-    protected void setUp() throws Exception {
-        MockScheduledEventMessageComposer.reset();
-        MockScheduledEventListener.reset();
-        MockAction.message = null;
-    }
-
-    public void test_simple_schedule_01() throws UnsupportedEncodingException, ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
-        runTestConfig("config-01.xml", 10000);
-
-        JBESB_2146_ScheduledEventMessageComposer composer1 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener1");
-        JBESB_2146_ScheduledEventMessageComposer composer2 = JBESB_2146_ScheduledEventMessageComposer.getComposer("simple-schedule-listener2");
-
-        System.out.println(composer1.composedMessages.size());
-        System.out.println(composer2.composedMessages.size());
-    }
-
-    private void runTestConfig(String configName, long upTime) throws ParamRepositoryException, ConfigurationException, ManagedLifecycleException, SAXException, InterruptedException {
-        ESBConfigUtil configUtil = null;
-        try {
-            configUtil = new ESBConfigUtil(getClass().getResourceAsStream(configName));
-        } catch (IOException e) {
-            fail(e.getMessage());
-        }
-
-        configUtil.startController();
-        Thread.sleep(upTime);
-        configUtil.stopController();
-    }
-}
\ No newline at end of file

Modified: labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml
===================================================================
--- labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml	2008-11-03 16:29:57 UTC (rev 23679)
+++ labs/jbossesb/branches/JBESB_4_4_GA_CP/product/rosetta/tests/src/org/jboss/soa/esb/schedule/JBESB_2146/config-01.xml	2008-11-03 19:08:22 UTC (rev 23680)
@@ -4,7 +4,6 @@
     <providers>
         <schedule-provider name="schedule">
             <cron-schedule scheduleid="schedule1" cronExpression="0/2 * * * * ?"/>
-            <cron-schedule scheduleid="schedule2" cronExpression="0/1 * * * * ?"/>
         </schedule-provider>
     </providers>
 
@@ -22,7 +21,7 @@
         <service category="ServiceCat" name="ServiceName-02" description="Test Service">
 
             <listeners>
-                <scheduled-listener name="simple-schedule-listener2" scheduleidref="schedule2" event-processor="org.jboss.soa.esb.schedule.JBESB_2146.JBESB_2146_ScheduledEventMessageComposer" />
+                <scheduled-listener name="simple-schedule-listener2" scheduleidref="schedule1" event-processor="org.jboss.soa.esb.schedule.JBESB_2146.JBESB_2146_ScheduledEventMessageComposer" />
             </listeners>
 
             <actions>




More information about the jboss-svn-commits mailing list