You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/02/28 16:10:32 UTC
svn commit: r748864 - in /camel/trunk/components/camel-quartz: ./
src/main/java/org/apache/camel/component/quartz/
src/test/java/org/apache/camel/component/quartz/ src/test/resources/
Author: davsclaus
Date: Sat Feb 28 15:10:32 2009
New Revision: 748864
URL: http://svn.apache.org/viewvc?rev=748864&view=rev
Log:
CAMEL-1407: Improved setting cron on camel quartz.
Added:
camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzConstants.java (with props)
camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzCronRouteTest.java
- copied, changed from r748781, camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteTest.java
Modified:
camel/trunk/components/camel-quartz/pom.xml
camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/CamelJob.java
camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/StatefulCamelJob.java
camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzEndpointConfigureTest.java
camel/trunk/components/camel-quartz/src/test/resources/log4j.properties
Modified: camel/trunk/components/camel-quartz/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/pom.xml?rev=748864&r1=748863&r2=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/pom.xml (original)
+++ camel/trunk/components/camel-quartz/pom.xml Sat Feb 28 15:10:32 2009
@@ -20,100 +20,99 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>camel-quartz</artifactId>
- <packaging>bundle</packaging>
- <name>Camel :: Quartz</name>
- <description>Camel Quartz support</description>
-
- <properties>
- <camel.osgi.export.pkg>org.apache.camel.component.quartz.*</camel.osgi.export.pkg>
- </properties>
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quartz</artifactId>
+ <packaging>bundle</packaging>
+ <name>Camel :: Quartz</name>
+ <description>Camel Quartz support</description>
+
+ <properties>
+ <camel.osgi.export.pkg>org.apache.camel.component.quartz.*</camel.osgi.export.pkg>
+ </properties>
<repositories>
<repository>
- <id>servicemix</id>
- <name>Apache ServiceMix Repository</name>
- <url>http://svn.apache.org/repos/asf/servicemix/m2-repo</url>
+ <id>open.iona.m2-all</id>
+ <name>IONA All Dependency Repository</name>
+ <url>http://repo.open.iona.com/maven2-all</url>
</repository>
</repositories>
- <dependencies>
+ <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- </dependency>
- <dependency>
- <groupId>opensymphony</groupId>
- <artifactId>quartz</artifactId>
- <version>1.6.1</version>
- </dependency>
- <!-- commons-collections is needed at runtime by quartz -->
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
-
- <!-- testing -->
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <!-- to allow Spring annotations (jmx) to be tested -->
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- <optional>true</optional>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- <optional>true</optional>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <childDelegation>false</childDelegation>
- <useFile>true</useFile>
- <excludes>
- <!-- TODO - FIXME ASAP -->
- <exclude>**/JmsRouteUsingSpringWithAutoWireTest.*</exclude>
- </excludes>
- </configuration>
- </plugin>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>opensymphony</groupId>
+ <artifactId>quartz-all</artifactId>
+ <version>1.6.4</version>
+ </dependency>
+ <!-- commons-collections is needed at runtime by quartz -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
+
+ <!-- testing -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- to allow Spring annotations (jmx) to be tested -->
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-context</artifactId>
+ <optional>true</optional>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-aop</artifactId>
+ <optional>true</optional>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <childDelegation>false</childDelegation>
+ <useFile>true</useFile>
+ <excludes>
+ <exclude>**/XXXTest.*</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
- </plugins>
- </build>
+ </plugins>
+ </build>
</project>
Modified: camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/CamelJob.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/CamelJob.java?rev=748864&r1=748863&r2=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/CamelJob.java (original)
+++ camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/CamelJob.java Sat Feb 28 15:10:32 2009
@@ -25,9 +25,9 @@
*/
public class CamelJob implements Job {
public void execute(JobExecutionContext context) throws JobExecutionException {
- QuartzEndpoint component = (QuartzEndpoint) context.getJobDetail().getJobDataMap().get(QuartzEndpoint.ENDPOINT_KEY);
+ QuartzEndpoint component = (QuartzEndpoint) context.getJobDetail().getJobDataMap().get(QuartzConstants.QUARTZ_ENDPOINT);
if (component == null) {
- throw new JobExecutionException("No quartz endpoint available for key: " + QuartzEndpoint.ENDPOINT_KEY);
+ throw new JobExecutionException("No quartz endpoint available for key: " + QuartzConstants.QUARTZ_ENDPOINT);
}
component.onJobExecute(context);
}
Modified: camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java?rev=748864&r1=748863&r2=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java (original)
+++ camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzComponent.java Sat Feb 28 15:10:32 2009
@@ -17,11 +17,13 @@
package org.apache.camel.component.quartz;
import java.net.URI;
+import java.text.ParseException;
import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.impl.DefaultComponent;
import org.apache.camel.util.IntrospectionSupport;
+import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.CronTrigger;
@@ -29,11 +31,15 @@
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.quartz.SchedulerFactory;
+import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
import org.quartz.impl.StdSchedulerFactory;
/**
* A <a href="http://camel.apache.org/quartz.html">Quartz Component</a>
+ * <p/>
+ * For a bried tutorial on setting cron expression see
+ * <a href="http://www.opensymphony.com/quartz/wikidocs/CronTriggers%20Tutorial.html">Quartz cron tutorial</a>.
*
* @version $Revision:520964 $
*/
@@ -56,37 +62,30 @@
// lets split the remaining into a group/name
URI u = new URI(uri);
+ String path = ObjectHelper.after(u.getPath(), "/");
+ String host = u.getHost();
+ String cron = getAndRemoveParameter(parameters, "cron", String.class);
+
+ // group can be optional, if so set it to Camel
String name;
- String group = "Camel";
- String path = u.getPath();
- CronTrigger cronTrigger = null;
- if (path != null && path.length() > 1) {
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- int idx = path.indexOf('/');
- if (idx > 0) {
- cronTrigger = new CronTrigger();
- name = path.substring(0, idx);
- String cronExpression = path.substring(idx + 1);
- // lets allow / instead of spaces and allow $ instead of ?
- cronExpression = cronExpression.replace('/', ' ');
- cronExpression = cronExpression.replace('$', '?');
- LOG.debug("Creating cron trigger: " + cronExpression);
- cronTrigger.setCronExpression(cronExpression);
- answer.setTrigger(cronTrigger);
- } else {
- name = path;
- }
- group = u.getHost();
+ String group;
+ if (ObjectHelper.isNotEmpty(path) && ObjectHelper.isNotEmpty(host)) {
+ group = host;
+ name = path;
} else {
- name = u.getHost();
+ group = "Camel";
+ name = host;
}
- Trigger trigger = cronTrigger;
- if (trigger == null) {
- trigger = answer.getTrigger();
+ // create the trigger either cron or simple
+ Trigger trigger;
+ if (ObjectHelper.isNotEmpty(cron)) {
+ trigger = createCronTrigger(cron);
+ } else {
+ trigger = new SimpleTrigger();
}
+ answer.setTrigger(trigger);
+
trigger.setName(name);
trigger.setGroup(group);
@@ -99,15 +98,28 @@
return answer;
}
+ protected CronTrigger createCronTrigger(String path) throws ParseException {
+ // replace _ back to space so its a cron expression
+ String s = path.replaceAll("_", " ");
+ CronTrigger cron = new CronTrigger();
+ cron.setCronExpression(s);
+ return cron;
+ }
+
@Override
protected void doStart() throws Exception {
super.doStart();
- getScheduler().start();
+ if (scheduler == null) {
+ scheduler = getScheduler();
+ }
+ LOG.debug("Starting Quartz scheduler: " + scheduler.getSchedulerName());
+ scheduler.start();
}
@Override
protected void doStop() throws Exception {
if (scheduler != null) {
+ LOG.debug("Shutting down Quartz scheduler: " + scheduler.getSchedulerName());
scheduler.shutdown();
}
super.doStop();
@@ -153,7 +165,7 @@
protected Scheduler createScheduler() throws SchedulerException {
Scheduler scheduler = getFactory().getScheduler();
- scheduler.getContext().put(QuartzEndpoint.CONTEXT_KEY, getCamelContext());
+ scheduler.getContext().put(QuartzConstants.QUARTZ_CAMEL_CONTEXT, getCamelContext());
return scheduler;
}
}
Added: camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzConstants.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzConstants.java?rev=748864&view=auto
==============================================================================
--- camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzConstants.java (added)
+++ camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzConstants.java Sat Feb 28 15:10:32 2009
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.quartz;
+
+/**
+ * Quartz constants.
+ */
+public final class QuartzConstants {
+
+ public static final String QUARTZ_ENDPOINT = "CamelQuartzEndpoint";
+
+ public static final String QUARTZ_CAMEL_CONTEXT = "CamelQuartzCamelContext";
+
+ private QuartzConstants() {
+ // Utility class
+ }
+}
Propchange: camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzConstants.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzConstants.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified: camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java?rev=748864&r1=748863&r2=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java (original)
+++ camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/QuartzEndpoint.java Sat Feb 28 15:10:32 2009
@@ -34,7 +34,6 @@
import org.quartz.JobExecutionException;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
-import org.quartz.SimpleTrigger;
import org.quartz.Trigger;
/**
@@ -43,9 +42,6 @@
* @version $Revision:520964 $
*/
public class QuartzEndpoint extends DefaultEndpoint {
- public static final String ENDPOINT_KEY = "org.apache.camel.quartz";
- public static final String CONTEXT_KEY = "org.apache.camel.CamelContext";
-
private static final transient Log LOG = LogFactory.getLog(QuartzEndpoint.class);
private Scheduler scheduler;
@@ -95,7 +91,7 @@
if (trigger.getStartTime() == null) {
trigger.setStartTime(new Date());
}
- detail.getJobDataMap().put(ENDPOINT_KEY, isStateful() ? getEndpointUri() : this);
+ detail.getJobDataMap().put(QuartzConstants.QUARTZ_ENDPOINT, isStateful() ? getEndpointUri() : this);
if (detail.getJobClass() == null) {
detail.setJobClass(isStateful() ? StatefulCamelJob.class : CamelJob.class);
}
@@ -186,9 +182,6 @@
}
public Trigger getTrigger() {
- if (trigger == null) {
- trigger = createTrigger();
- }
return trigger;
}
@@ -211,6 +204,7 @@
// Implementation methods
// -------------------------------------------------------------------------
public synchronized void consumerStarted(final QuartzConsumer consumer) throws SchedulerException {
+ ObjectHelper.notNull(trigger, "trigger");
getLoadBalancer().addProcessor(consumer.getProcessor());
// if we have not yet added our default trigger, then lets do it
@@ -221,6 +215,7 @@
}
public synchronized void consumerStopped(final QuartzConsumer consumer) throws SchedulerException {
+ ObjectHelper.notNull(trigger, "trigger");
getLoadBalancer().removeProcessor(consumer.getProcessor());
if (getLoadBalancer().getProcessors().isEmpty() && started) {
removeTrigger(getTrigger(), getJobDetail());
@@ -236,7 +231,4 @@
return new JobDetail();
}
- protected Trigger createTrigger() {
- return new SimpleTrigger();
- }
}
Modified: camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/StatefulCamelJob.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/StatefulCamelJob.java?rev=748864&r1=748863&r2=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/StatefulCamelJob.java (original)
+++ camel/trunk/components/camel-quartz/src/main/java/org/apache/camel/component/quartz/StatefulCamelJob.java Sat Feb 28 15:10:32 2009
@@ -36,8 +36,8 @@
throw new JobExecutionException("Failed to obtain scheduler context for job " + context.getJobDetail().getName());
}
- CamelContext camelContext = (CamelContext) schedulerContext.get(QuartzEndpoint.CONTEXT_KEY);
- String endpointUri = (String) context.getJobDetail().getJobDataMap().get(QuartzEndpoint.ENDPOINT_KEY);
+ CamelContext camelContext = (CamelContext) schedulerContext.get(QuartzConstants.QUARTZ_CAMEL_CONTEXT);
+ String endpointUri = (String) context.getJobDetail().getJobDataMap().get(QuartzConstants.QUARTZ_ENDPOINT);
QuartzEndpoint quartzEndpoint = (QuartzEndpoint) camelContext.getEndpoint(endpointUri);
quartzEndpoint.onJobExecute(context);
}
Copied: camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzCronRouteTest.java (from r748781, camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteTest.java)
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzCronRouteTest.java?p2=camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzCronRouteTest.java&p1=camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteTest.java&r1=748781&r2=748864&rev=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzRouteTest.java (original)
+++ camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzCronRouteTest.java Sat Feb 28 15:10:32 2009
@@ -16,43 +16,31 @@
*/
package org.apache.camel.component.quartz;
-import java.util.List;
-
import org.apache.camel.ContextTestSupport;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
/**
* @version $Revision$
*/
-public class QuartzRouteTest extends ContextTestSupport {
- protected MockEndpoint resultEndpoint;
-
- public void testQuartzRoute() throws Exception {
- resultEndpoint = getMockEndpoint("mock:result");
- resultEndpoint.expectedMessageCount(2);
- resultEndpoint.message(0).header("triggerName").isEqualTo("myTimerName");
- resultEndpoint.message(0).header("triggerGroup").isEqualTo("myGroup");
+public class QuartzCronRouteTest extends ContextTestSupport {
- // lets test the receive worked
- resultEndpoint.assertIsSatisfied();
+ public void testQuartzCronRoute() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(3);
- List<Exchange> list = resultEndpoint.getReceivedExchanges();
- for (Exchange exchange : list) {
- Message in = exchange.getIn();
- log.debug("Received: " + in + " with headers: " + in.getHeaders());
- }
+ assertMockEndpointsSatisfied();
}
@Override
protected RouteBuilder createRouteBuilder() {
return new RouteBuilder() {
public void configure() {
- // START SNIPPET: example
- from("quartz://myGroup/myTimerName?trigger.repeatInterval=2&trigger.repeatCount=1").to("mock:result");
- // END SNIPPET: example
+ // START SNIPPET: e1
+ // triggers every 2th second at precise 00,02,04,06..58
+ // notice we must use _ as space when configurd using URI parameter
+ from("quartz://myGroup/myTimerName?cron=0/2_*_*_*_*_?").to("mock:result");
+ // END SNIPPET: e1
}
};
}
Modified: camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzEndpointConfigureTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzEndpointConfigureTest.java?rev=748864&r1=748863&r2=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzEndpointConfigureTest.java (original)
+++ camel/trunk/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/QuartzEndpointConfigureTest.java Sat Feb 28 15:10:32 2009
@@ -46,11 +46,19 @@
}
public void testConfigureCronExpression() throws Exception {
- QuartzEndpoint endpoint = resolveMandatoryEndpoint("quartz://myGroup/myTimerName/0/0/12/*/*/$");
+ QuartzEndpoint endpoint = resolveMandatoryEndpoint("quartz://myGroup/myTimerName?cron=0_0/5_12-18_?_*_MON-FRI");
CronTrigger trigger = assertIsInstanceOf(CronTrigger.class, endpoint.getTrigger());
assertEquals("getName()", "myTimerName", trigger.getName());
assertEquals("getGroup()", "myGroup", trigger.getGroup());
- assertEquals("cron expression", "0 0 12 * * ?", trigger.getCronExpression());
+ assertEquals("cron expression", "0 0/5 12-18 ? * MON-FRI", trigger.getCronExpression());
+ }
+
+ public void testConfigureAnotherCronExpression() throws Exception {
+ QuartzEndpoint endpoint = resolveMandatoryEndpoint("quartz://myGroup/myTimerName?cron=0_0_*_*_*_?");
+ CronTrigger trigger = assertIsInstanceOf(CronTrigger.class, endpoint.getTrigger());
+ assertEquals("getName()", "myTimerName", trigger.getName());
+ assertEquals("getGroup()", "myGroup", trigger.getGroup());
+ assertEquals("cron expression", "0 0 * * * ?", trigger.getCronExpression());
}
@Override
Modified: camel/trunk/components/camel-quartz/src/test/resources/log4j.properties
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-quartz/src/test/resources/log4j.properties?rev=748864&r1=748863&r2=748864&view=diff
==============================================================================
--- camel/trunk/components/camel-quartz/src/test/resources/log4j.properties (original)
+++ camel/trunk/components/camel-quartz/src/test/resources/log4j.properties Sat Feb 28 15:10:32 2009
@@ -21,7 +21,7 @@
log4j.rootLogger=INFO, file
# uncomment the following to enable camel debugging
-log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel=DEBUG
# CONSOLE appender not used by default
log4j.appender.out=org.apache.log4j.ConsoleAppender