camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hadr...@apache.org
Subject svn commit: r1220995 - in /camel/branches/camel-2.8.x/components/camel-quartz/src: main/java/org/apache/camel/component/quartz/ test/java/org/apache/camel/component/quartz/
Date Mon, 19 Dec 2011 23:06:00 GMT
Author: hadrian
Date: Mon Dec 19 23:05:59 2011
New Revision: 1220995

URL: http://svn.apache.org/viewvc?rev=1220995&view=rev
Log:
CAMEL-4794. Fix trigger restart. Shortened test time.

Modified:
    camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
    camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
    camel/branches/camel-2.8.x/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java

Modified: camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java?rev=1220995&r1=1220994&r2=1220995&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
Mon Dec 19 23:05:59 2011
@@ -21,6 +21,7 @@ import java.io.InputStream;
 import java.net.URI;
 import java.text.ParseException;
 import java.util.ArrayList;
+import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -229,7 +230,8 @@ public class QuartzComponent extends Def
         } else {
             LOG.debug("Trigger: {}/{} already exists and will be resumed automatically by
Quartz.", trigger.getGroup(), trigger.getName());
             if (!isClustered()) {
-                scheduler.resumeTrigger(trigger.getName(), trigger.getGroup());
+                trigger.setStartTime(Calendar.getInstance().getTime());
+                scheduler.rescheduleJob(trigger.getName(), trigger.getGroup(), trigger);
             }
         }
     }

Modified: camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java?rev=1220995&r1=1220994&r2=1220995&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
Mon Dec 19 23:05:59 2011
@@ -47,7 +47,7 @@ public class QuartzEndpoint extends Defa
 
     private LoadBalancer loadBalancer;
     private Trigger trigger;
-    private JobDetail jobDetail;
+    private JobDetail jobDetail = new JobDetail();
     private volatile boolean started;
     private volatile boolean stateful;
 
@@ -174,9 +174,6 @@ public class QuartzEndpoint extends Defa
     }
 
     public JobDetail getJobDetail() {
-        if (jobDetail == null) {
-            jobDetail = createJobDetail();
-        }
         return jobDetail;
     }
 
@@ -230,10 +227,6 @@ public class QuartzEndpoint extends Defa
         return new RoundRobinLoadBalancer();
     }
 
-    protected JobDetail createJobDetail() {
-        return new JobDetail();
-    }
-
     @Override
     protected void doStart() throws Exception {
         ObjectHelper.notNull(getComponent(), "QuartzComponent", this);
@@ -250,5 +243,4 @@ public class QuartzEndpoint extends Defa
         ObjectHelper.notNull(trigger, "trigger");
         deleteTrigger(getTrigger());
     }
-
 }

Modified: camel/branches/camel-2.8.x/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.8.x/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java?rev=1220995&r1=1220994&r2=1220995&view=diff
==============================================================================
--- camel/branches/camel-2.8.x/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
(original)
+++ camel/branches/camel-2.8.x/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteRestartTest.java
Mon Dec 19 23:05:59 2011
@@ -33,13 +33,12 @@ import org.junit.Test;
 public class QuartzRouteRestartTest extends CamelTestSupport {
 
     @Test
-    @Ignore("CAMEL-4794")
     public void testQuartzCronRoute() throws Exception {
         MockEndpoint mock = getMockEndpoint("mock:result");
-        mock.setResultWaitTime(20000);
+        mock.setResultWaitTime(15000);
         mock.expectedMinimumMessageCount(3);
-        mock.message(1).arrives().between(9, 11).seconds().afterPrevious();
-        mock.message(2).arrives().between(4, 6).seconds().afterPrevious();
+        mock.message(0).arrives().between(7, 9).seconds().beforeNext();
+        mock.message(2).arrives().between(3, 5).seconds().afterPrevious();
 
         assertMockEndpointsSatisfied();
     }
@@ -49,7 +48,7 @@ public class QuartzRouteRestartTest exte
         return new RouteBuilder() {
             public void configure() {
                 // START SNIPPET: e1
-                from("quartz://groupName/timerName?cron=0/5+*+*+*+*+?").routeId("trigger")
+                from("quartz://groupName/timerName?cron=0/4+*+*+*+*+?").routeId("trigger")
                     .setBody(bean(CurrentTime.class))
                     // .to("log:QUARTZ")
                     .to("seda:control");
@@ -64,7 +63,7 @@ public class QuartzRouteRestartTest exte
                             if (!DONE) {
                                 DONE = true;
                                 exchange.getContext().stopRoute("trigger");
-                                Thread.sleep(7000);
+                                Thread.sleep(5000);
                                 exchange.getContext().startRoute("trigger");
                             }
                         }



Mime
View raw message