camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ningji...@apache.org
Subject [1/6] git commit: CAMEL-4075 fixed bunch of CS errors
Date Sat, 03 Aug 2013 09:04:07 GMT
Updated Branches:
  refs/heads/master 557514020 -> c15a3fc1a


CAMEL-4075 fixed bunch of CS errors


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/1fd5dbe5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/1fd5dbe5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/1fd5dbe5

Branch: refs/heads/master
Commit: 1fd5dbe528fa997811644cde7e5540f02360b7c6
Parents: e429d7c
Author: Willem Jiang <ningjiang@apache.org>
Authored: Sat Aug 3 15:47:13 2013 +0800
Committer: Willem Jiang <ningjiang@apache.org>
Committed: Sat Aug 3 16:57:05 2013 +0800

----------------------------------------------------------------------
 .../camel/component/quartz2/CamelJob.java       | 25 +++++---
 .../component/quartz2/QuartzComponent.java      | 38 ++++++-----
 .../camel/component/quartz2/QuartzEndpoint.java | 66 +++++++++++---------
 .../camel/component/quartz2/QuartzMessage.java  |  5 +-
 .../quartz2/CronScheduledRoutePolicy.java       |  4 +-
 .../camel/routepolicy/quartz2/ScheduledJob.java | 12 ++--
 .../quartz2/ScheduledRoutePolicy.java           | 19 +++---
 .../quartz2/SimpleScheduledRoutePolicy.java     | 11 ++--
 .../QuartzCronRouteWithSmallCacheTest.java      |  6 +-
 .../quartz2/QuartzEndpointConfigureTest.java    |  8 ++-
 .../quartz2/QuartzNameCollisionTest.java        |  2 +-
 .../component/quartz2/QuartzPropertiesTest.java |  8 +--
 .../quartz2/StatefulQuartzRouteTest.java        |  6 +-
 .../quartz2/CronScheduledRoutePolicyTest.java   |  4 +-
 .../quartz2/MultiplePoliciesOnRouteTest.java    |  4 +-
 .../SimpleScheduledCombinedRoutePolicyTest.java |  7 +--
 .../quartz2/SimpleScheduledRoutePolicyTest.java |  9 +--
 .../SpringMultiplePoliciesOnRouteTest.java      |  4 +-
 .../quartz2/SpringScheduledRoutePolicyTest.java |  8 +--
 19 files changed, 135 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/CamelJob.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/CamelJob.java
b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/CamelJob.java
index 544dde0..5be89b3 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/CamelJob.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/CamelJob.java
@@ -20,7 +20,12 @@ import org.apache.camel.CamelContext;
 import org.apache.camel.CamelExchangeException;
 import org.apache.camel.Exchange;
 import org.apache.camel.Route;
-import org.quartz.*;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.SchedulerContext;
+import org.quartz.SchedulerException;
+import org.quartz.TriggerKey;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -28,7 +33,6 @@ import org.slf4j.LoggerFactory;
  * This is a Quartz Job that is scheduled by QuartzEndpoint's Consumer and will call it to
  * produce a QuartzMessage sending to a route.
  *
- * @author Zemian Deng saltnlight5@gmail.com
  */
 public class CamelJob implements Job {
     private static final transient Logger LOG = LoggerFactory.getLogger(CamelJob.class);
@@ -37,8 +41,9 @@ public class CamelJob implements Job {
     public void execute(JobExecutionContext context) throws JobExecutionException {
         Exchange exchange = null;
         try {
-            if (LOG.isDebugEnabled())
+            if (LOG.isDebugEnabled()) {
                 LOG.debug("Running CamelJob jobExecutionContext={}", context);
+            }
 
             CamelContext camelContext = getCamelContext(context);
             QuartzEndpoint endpoint = lookupQuartzEndpoint(camelContext, context);
@@ -50,10 +55,11 @@ public class CamelJob implements Job {
                 throw new JobExecutionException(exchange.getException());
             }
         } catch (Exception e) {
-            if (exchange != null)
+            if (exchange != null) {
                 LOG.error(CamelExchangeException.createExceptionMessage("Error processing
exchange", exchange, e));
-            else
+            } else {
                 LOG.error("Failed to execute CamelJob.", e);
+            }
 
             // and rethrow to let quartz handle it
             if (e instanceof JobExecutionException) {
@@ -83,8 +89,9 @@ public class CamelJob implements Job {
 
     private QuartzEndpoint lookupQuartzEndpoint(CamelContext camelContext, JobExecutionContext
quartzContext) throws JobExecutionException {
         TriggerKey triggerKey = quartzContext.getTrigger().getKey();
-        if (LOG.isDebugEnabled())
+        if (LOG.isDebugEnabled()) {
             LOG.debug("Looking up existing QuartzEndpoint with triggerKey={}", triggerKey);
+        }
 
         // check all active routes for the quartz endpoint this task matches
         // as we prefer to use the existing endpoint from the routes
@@ -92,8 +99,9 @@ public class CamelJob implements Job {
             if (route.getEndpoint() instanceof QuartzEndpoint) {
                 QuartzEndpoint quartzEndpoint = (QuartzEndpoint) route.getEndpoint();
                 TriggerKey checkTriggerKey = quartzEndpoint.getTriggerKey();
-                if (LOG.isTraceEnabled())
+                if (LOG.isTraceEnabled()) {
                     LOG.trace("Checking route endpoint={} with checkTriggerKey={}", quartzEndpoint,
checkTriggerKey);
+                }
                 if (triggerKey.equals(checkTriggerKey)) {
                     return quartzEndpoint;
                 }
@@ -106,8 +114,9 @@ public class CamelJob implements Job {
 
         // Even though the same camelContext.getEndpoint call, but if/else display different
log.
         if (camelContext.hasEndpoint(endpointUri) != null) {
-            if (LOG.isDebugEnabled())
+            if (LOG.isDebugEnabled()) {
                 LOG.debug("Getting Endpoint from camelContext.");
+            }
             result = camelContext.getEndpoint(endpointUri, QuartzEndpoint.class);
         } else {
             LOG.warn("Cannot find existing QuartzEndpoint with uri: {}. Creating new endpoint
instance.", endpointUri);

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
index 8d78991..7f269f8 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzComponent.java
@@ -16,25 +16,28 @@
  */
 package org.apache.camel.component.quartz2;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.atomic.AtomicInteger;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
 import org.apache.camel.StartupListener;
-import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.impl.DefaultComponent;
 import org.apache.camel.util.IntrospectionSupport;
 import org.apache.camel.util.ObjectHelper;
-import org.quartz.*;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerContext;
+import org.quartz.SchedulerException;
+import org.quartz.SchedulerFactory;
+import org.quartz.TriggerKey;
 import org.quartz.impl.StdSchedulerFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.atomic.AtomicInteger;
-
 /**
  * A factory for QuartzEndpoint. This component will hold a Quartz Scheduler that will provide
scheduled timer based
  * endpoint that generate a QuartzMessage to a route. Currently it support Cron and Simple
trigger scheduling type.
@@ -43,9 +46,6 @@ import java.util.concurrent.atomic.AtomicInteger;
  * of the code, but mostly has been re-written in attempt to be more easier to maintain,
and use Quartz more
  * fully.</p>
  *
- * @author All the orignal authors from camel-quartz should get credits as well.
- * @author Zemian Deng saltnlight5@gmail.com - ported and re-implemented the camel-quartz2
component.
- * @since Jul-27-2013
  */
 public class QuartzComponent extends DefaultComponent implements StartupListener {
     private static final transient Logger LOG = LoggerFactory.getLogger(QuartzComponent.class);
@@ -55,7 +55,7 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
     private String propertiesFile;
     private int startDelayedSeconds;
     private boolean autoStartScheduler = true;
-    private boolean prefixJobNameWithEndpointId = false;
+    private boolean prefixJobNameWithEndpointId;
 
     public QuartzComponent() {
     }
@@ -198,12 +198,14 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
         }
 
         Boolean autoStartScheduler = getAndRemoveParameter(parameters, "autoStartScheduler",
Boolean.class);
-        if (autoStartScheduler != null)
+        if (autoStartScheduler != null) {
             this.autoStartScheduler = autoStartScheduler;
+        }
 
         Boolean prefixJobNameWithEndpointId = getAndRemoveParameter(parameters, "prefixJobNameWithEndpointId",
Boolean.class);
-        if (prefixJobNameWithEndpointId != null)
+        if (prefixJobNameWithEndpointId != null) {
             this.prefixJobNameWithEndpointId = prefixJobNameWithEndpointId;
+        }
 
         // Extract trigger.XXX and job.XXX properties to be set on endpoint below
         Map<String, Object> triggerParameters = IntrospectionSupport.extractProperties(parameters,
"trigger.");
@@ -230,7 +232,8 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
         }
 
         // Trigger group can be optional, if so set it to this context's unique name
-        String name, group;
+        String name;
+        String group;
         if (ObjectHelper.isNotEmpty(path) && ObjectHelper.isNotEmpty(host)) {
             group = host;
             name = path;
@@ -241,8 +244,9 @@ public class QuartzComponent extends DefaultComponent implements StartupListener
         }
 
 
-        if (prefixJobNameWithEndpointId)
+        if (prefixJobNameWithEndpointId) {
             name = endpoint.getId() + "_" + name;
+        }
 
         return new TriggerKey(name, group);
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
index bebb8b5..5c75191 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzEndpoint.java
@@ -16,28 +16,39 @@
  */
 package org.apache.camel.component.quartz2;
 
-import org.apache.camel.*;
+import java.util.Date;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.camel.Consumer;
+import org.apache.camel.Processor;
+import org.apache.camel.Producer;
+import org.apache.camel.Route;
 import org.apache.camel.impl.DefaultEndpoint;
 import org.apache.camel.processor.loadbalancer.LoadBalancer;
 import org.apache.camel.processor.loadbalancer.RoundRobinLoadBalancer;
 import org.apache.camel.util.EndpointHelper;
-import org.quartz.*;
+import org.quartz.Job;
+import org.quartz.JobBuilder;
+import org.quartz.JobDataMap;
+import org.quartz.JobDetail;
+import org.quartz.Scheduler;
+import org.quartz.SimpleTrigger;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
+import org.quartz.TriggerKey;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Date;
-import java.util.Map;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.atomic.AtomicInteger;
-
 import static org.quartz.CronScheduleBuilder.cronSchedule;
 import static org.quartz.SimpleScheduleBuilder.simpleSchedule;
 
+
 /**
  * This endpoint represent each job to be created in scheduler. When consumer is started
or stopped, it will
  * call back into doConsumerStart()/Stop() to pause/resume the scheduler trigger.
  *
- * @author Zemian Deng saltnlight5@gmail.com
  */
 public class QuartzEndpoint extends DefaultEndpoint {
     private static final transient Logger LOG = LoggerFactory.getLogger(QuartzEndpoint.class);
@@ -56,6 +67,10 @@ public class QuartzEndpoint extends DefaultEndpoint {
     // An internal variables to track whether a job has been in scheduler or not, and has
it paused or not.
     private AtomicBoolean jobAdded = new AtomicBoolean(false);
     private AtomicBoolean jobPaused = new AtomicBoolean(false);
+    
+    public QuartzEndpoint(String uri, QuartzComponent quartzComponent) {
+        super(uri, quartzComponent);
+    }
 
     public String getCron() {
         return cron;
@@ -102,8 +117,9 @@ public class QuartzEndpoint extends DefaultEndpoint {
     }
 
     public LoadBalancer getConsumerLoadBalancer() {
-        if (consumerLoadBalancer == null)
+        if (consumerLoadBalancer == null) {
             consumerLoadBalancer = new RoundRobinLoadBalancer();
+        }
         return consumerLoadBalancer;
     }
 
@@ -122,11 +138,7 @@ public class QuartzEndpoint extends DefaultEndpoint {
     public void setTriggerKey(TriggerKey triggerKey) {
         this.triggerKey = triggerKey;
     }
-
-    public QuartzEndpoint(String uri, QuartzComponent quartzComponent) {
-        super(uri, quartzComponent);
-    }
-
+    
     @Override
     public Producer createProducer() throws Exception {
         throw new UnsupportedOperationException("Quartz producer is not supported.");
@@ -156,8 +168,9 @@ public class QuartzEndpoint extends DefaultEndpoint {
 
     private void removeJobInScheduler() throws Exception {
         Scheduler scheduler = getComponent().getScheduler();
-        if (scheduler == null)
+        if (scheduler == null) {
             return;
+        }
 
         if (deleteJob) {
             boolean isClustered = scheduler.getMetaData().isJobStoreClustered();
@@ -188,11 +201,8 @@ public class QuartzEndpoint extends DefaultEndpoint {
             // Schedule it now. Remember that scheduler might not be started it, but we can
schedule now.
             Date nextFireDate = scheduler.scheduleJob(jobDetail, trigger);
             LOG.info("Job {} (triggerType={}, jobClass={}) is scheduled. Next fire date is
{}",
-                    new Object[]{
-                            trigger.getKey(),
-                            trigger.getClass().getSimpleName(),
-                            jobDetail.getJobClass().getSimpleName(),
-                            nextFireDate});
+                     new Object[] {trigger.getKey(), trigger.getClass().getSimpleName(),
+                          jobDetail.getJobClass().getSimpleName(), nextFireDate});
         } else {
             ensureNoDupTriggerKey();
 
@@ -202,11 +212,8 @@ public class QuartzEndpoint extends DefaultEndpoint {
             scheduler.addJob(jobDetail, true);
             Date nextFireDate = trigger.getNextFireTime();
             LOG.info("Reuse existing Job {} (triggerType={}, jobType={}) is scheduled. Next
fire date is {}",
-                    new Object[]{
-                            trigger.getKey(),
-                            trigger.getClass().getSimpleName(),
-                            jobDetail.getJobClass().getSimpleName(),
-                            nextFireDate});
+                     new Object[] {trigger.getKey(), trigger.getClass().getSimpleName(),
+                                   jobDetail.getJobClass().getSimpleName(), nextFireDate});
         }
 
         // Increase camel job count for this endpoint
@@ -241,8 +248,9 @@ public class QuartzEndpoint extends DefaultEndpoint {
     private Trigger createTrigger() throws Exception {
         Trigger result = null;
         Date startTime = new Date();
-        if (getComponent().getScheduler().isStarted())
+        if (getComponent().getScheduler().isStarted()) {
             startTime = new Date(System.currentTimeMillis() + triggerStartDelay);
+        }
         if (cron != null) {
             LOG.debug("Creating CronTrigger: {}", cron);
             result = TriggerBuilder.newTrigger()
@@ -310,8 +318,9 @@ public class QuartzEndpoint extends DefaultEndpoint {
     }
 
     public void pauseTrigger() throws Exception {
-        if (jobPaused.get())
+        if (jobPaused.get()) {
             return;
+        }
         jobPaused.set(true);
 
         Scheduler scheduler = getComponent().getScheduler();
@@ -322,8 +331,9 @@ public class QuartzEndpoint extends DefaultEndpoint {
     }
 
     public void resumeTrigger() throws Exception {
-        if (!jobPaused.get())
+        if (!jobPaused.get()) {
             return;
+        }
         jobPaused.set(false);
 
         Scheduler scheduler = getComponent().getScheduler();

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzMessage.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzMessage.java
b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzMessage.java
index 89fa907..7ea2eed 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzMessage.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/component/quartz2/QuartzMessage.java
@@ -16,17 +16,16 @@
  */
 package org.apache.camel.component.quartz2;
 
+import java.util.Map;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.impl.DefaultMessage;
 import org.quartz.JobExecutionContext;
 import org.quartz.Trigger;
 
-import java.util.Map;
-
 /**
  * A Camel message to be created upon each scheduled job execution.
  *
- * @author Zemian Deng saltnlight5@gmail.com
  */
 public class QuartzMessage extends DefaultMessage {
     private final JobExecutionContext jobExecutionContext;

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicy.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicy.java
b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicy.java
index ba840cd..19ecef4 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicy.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicy.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.Route;
 import org.apache.camel.component.quartz2.QuartzComponent;
 import org.apache.camel.util.ObjectHelper;
@@ -24,8 +26,6 @@ import org.quartz.CronTrigger;
 import org.quartz.Trigger;
 import org.quartz.TriggerBuilder;
 
-import java.util.concurrent.TimeUnit;
-
 public class CronScheduledRoutePolicy extends ScheduledRoutePolicy implements ScheduledRoutePolicyConstants
{
     private String routeStartTime;
     private String routeStopTime;

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledJob.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledJob.java
b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledJob.java
index e56d284..a118e8d 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledJob.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledJob.java
@@ -16,15 +16,19 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.io.Serializable;
+import java.util.List;
+
 import org.apache.camel.Route;
 import org.apache.camel.spi.RoutePolicy;
-import org.quartz.*;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.SchedulerContext;
+import org.quartz.SchedulerException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.io.Serializable;
-import java.util.List;
-
 public class ScheduledJob implements Job, Serializable, ScheduledRoutePolicyConstants {
     private static final transient Logger LOG = LoggerFactory.getLogger(ScheduledJob.class);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledRoutePolicy.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledRoutePolicy.java
b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledRoutePolicy.java
index c14c342..4543dc8 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledRoutePolicy.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/ScheduledRoutePolicy.java
@@ -16,18 +16,24 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.Route;
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.impl.RoutePolicySupport;
 import org.apache.camel.util.ServiceHelper;
-import org.quartz.*;
+import org.quartz.JobBuilder;
+import org.quartz.JobDetail;
+import org.quartz.JobKey;
+import org.quartz.Scheduler;
+import org.quartz.SchedulerException;
+import org.quartz.Trigger;
+import org.quartz.TriggerKey;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.concurrent.TimeUnit;
-
 /**
  * This is Quartz2.x based RoutePolicy implementation that re-use almost identical to "camel-quartz"
component.
  *
@@ -38,9 +44,6 @@ import java.util.concurrent.TimeUnit;
  *
  * See org.apache.camel.component.quartz2.QuartzComponent
  *
- * @author All the orignal authors from camel-quartz should get credits as well.
- * @author Zemian Deng saltnlight5@gmail.com - ported and re-implemented the camel-quartz2
component.
- * @since Jul-27-2013
  */
 public abstract class ScheduledRoutePolicy extends RoutePolicySupport implements ScheduledRoutePolicyConstants
{
     private static final transient Logger LOG = LoggerFactory.getLogger(ScheduledRoutePolicy.class);

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicy.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicy.java
b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicy.java
index bc93c57..2e84d4a 100644
--- a/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicy.java
+++ b/components/camel-quartz2/src/main/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicy.java
@@ -16,13 +16,16 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.Route;
 import org.apache.camel.component.quartz2.QuartzComponent;
 import org.apache.camel.util.ObjectHelper;
-import org.quartz.*;
-
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
+import org.quartz.SimpleScheduleBuilder;
+import org.quartz.SimpleTrigger;
+import org.quartz.Trigger;
+import org.quartz.TriggerBuilder;
 
 public class SimpleScheduledRoutePolicy extends ScheduledRoutePolicy {
     private Date routeStartDate;

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzCronRouteWithSmallCacheTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzCronRouteWithSmallCacheTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzCronRouteWithSmallCacheTest.java
index d1ff451..2e2cbd0 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzCronRouteWithSmallCacheTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzCronRouteWithSmallCacheTest.java
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.component.quartz2;
 
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.Exchange;
 import org.apache.camel.Processor;
@@ -23,9 +26,6 @@ import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
 /**
  * Endpoints are stored in a LRU list with a default capacity of 1000. If the list is full,
  * then endpoints are removed and should be recreated.

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzEndpointConfigureTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzEndpointConfigureTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzEndpointConfigureTest.java
index 6b7f9c5..c2fea04 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzEndpointConfigureTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzEndpointConfigureTest.java
@@ -19,7 +19,13 @@ package org.apache.camel.component.quartz2;
 import org.apache.camel.Endpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
-import org.quartz.*;
+import org.quartz.CronTrigger;
+import org.quartz.JobDetail;
+import org.quartz.JobKey;
+import org.quartz.Scheduler;
+import org.quartz.SimpleTrigger;
+import org.quartz.Trigger;
+import org.quartz.TriggerKey;
 
 /**
  * @version 

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzNameCollisionTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzNameCollisionTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzNameCollisionTest.java
index 7027714..66a620f 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzNameCollisionTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzNameCollisionTest.java
@@ -55,7 +55,7 @@ public class QuartzNameCollisionTest {
             Assert.fail("Should have thrown an exception");
         } catch (FailedToCreateRouteException e) {
             String reason = e.getMessage();
-            Assert.assertEquals(reason.indexOf("Trigger key myGroup.myTimerName is already
in used") >=0, true);
+            Assert.assertEquals(reason.indexOf("Trigger key myGroup.myTimerName is already
in used") >= 0, true);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
index 9ba69cc..3a31efa 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/QuartzPropertiesTest.java
@@ -16,16 +16,14 @@
  */
 package org.apache.camel.component.quartz2;
 
+import java.io.InputStream;
+import java.util.Properties;
+
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 import org.quartz.SchedulerException;
 
-import java.io.InputStream;
-import java.util.Properties;
 
-/**
- * @version 
- */
 public class QuartzPropertiesTest extends CamelTestSupport {
 
     private QuartzComponent quartz;

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/StatefulQuartzRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/StatefulQuartzRouteTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/StatefulQuartzRouteTest.java
index 5ee23ac..a690667 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/StatefulQuartzRouteTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/component/quartz2/StatefulQuartzRouteTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.component.quartz2;
 
+import java.util.List;
+
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.builder.RouteBuilder;
@@ -23,11 +25,7 @@ import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.util.List;
 
-/**
- * @version 
- */
 public class StatefulQuartzRouteTest extends CamelTestSupport {
     protected MockEndpoint resultEndpoint;
 

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicyTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicyTest.java
index 1d50801..6b6ace4 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicyTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/CronScheduledRoutePolicyTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.Consumer;
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.SuspendableService;
@@ -26,8 +28,6 @@ import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.camel.util.ServiceHelper;
 import org.junit.Test;
 
-import java.util.concurrent.TimeUnit;
-
 /**
  * @version 
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/MultiplePoliciesOnRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/MultiplePoliciesOnRouteTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/MultiplePoliciesOnRouteTest.java
index 1aeff90..ddc7b71 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/MultiplePoliciesOnRouteTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/MultiplePoliciesOnRouteTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.Date;
+
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -26,8 +28,6 @@ import org.apache.camel.spi.RoutePolicy;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.util.Date;
-
 /**
  * @version 
  */

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledCombinedRoutePolicyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledCombinedRoutePolicyTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledCombinedRoutePolicyTest.java
index 17e254b..e839274 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledCombinedRoutePolicyTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledCombinedRoutePolicyTest.java
@@ -16,6 +16,8 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.Date;
+
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
@@ -23,11 +25,6 @@ import org.apache.camel.component.quartz2.QuartzComponent;
 import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 
-import java.util.Date;
-
-/**
- * @version 
- */
 public class SimpleScheduledCombinedRoutePolicyTest extends CamelTestSupport {
     
     @Override

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicyTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicyTest.java
index 87ae238..942fb2d 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicyTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SimpleScheduledRoutePolicyTest.java
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.ServiceStatus;
 import org.apache.camel.builder.RouteBuilder;
@@ -27,12 +30,6 @@ import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import java.util.Date;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @version 
- */
 public class SimpleScheduledRoutePolicyTest extends CamelTestSupport {
     private static final transient Logger LOG = LoggerFactory.getLogger(SimpleScheduledRoutePolicyTest.class);
     

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringMultiplePoliciesOnRouteTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringMultiplePoliciesOnRouteTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringMultiplePoliciesOnRouteTest.java
index b370301..52dc336 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringMultiplePoliciesOnRouteTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringMultiplePoliciesOnRouteTest.java
@@ -21,9 +21,7 @@ import org.junit.Test;
 import org.springframework.context.support.AbstractApplicationContext;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-/**
- * @version 
- */
+
 public class SpringMultiplePoliciesOnRouteTest extends CamelSpringTestSupport {
     private String url = "seda:foo?concurrentConsumers=20";
     private int size = 100;

http://git-wip-us.apache.org/repos/asf/camel/blob/1fd5dbe5/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringScheduledRoutePolicyTest.java
----------------------------------------------------------------------
diff --git a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringScheduledRoutePolicyTest.java
b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringScheduledRoutePolicyTest.java
index b4b40ac..2926418 100644
--- a/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringScheduledRoutePolicyTest.java
+++ b/components/camel-quartz2/src/test/java/org/apache/camel/routepolicy/quartz2/SpringScheduledRoutePolicyTest.java
@@ -16,6 +16,9 @@
  */
 package org.apache.camel.routepolicy.quartz2;
 
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
 import org.apache.camel.CamelContext;
 import org.apache.camel.CamelExecutionException;
 import org.apache.camel.ServiceStatus;
@@ -28,12 +31,7 @@ import org.apache.camel.test.junit4.TestSupport;
 import org.apache.camel.util.ServiceHelper;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 
-import java.util.List;
-import java.util.concurrent.TimeUnit;
 
-/**
- * @version 
- */
 public abstract class SpringScheduledRoutePolicyTest extends TestSupport {
     protected enum TestType {
         SIMPLE, CRON


Mime
View raw message