Updated Branches: refs/heads/master c86726616 -> 15e0c6d8f
Added test for camel-quartz based on a user forum post, also polished another test a bit (both of which are about Quartz based clustering setup triggered either through QuartzConsumer or CronScheduledRoutePolicy). Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/15e0c6d8 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/15e0c6d8 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/15e0c6d8 Branch: refs/heads/master Commit: 15e0c6d8f4a37ed30ec11ff9b2899225fac7c1ef Parents: c867266 Author: Babak Vahdat <bvah...@apache.org> Authored: Sat Sep 28 20:51:32 2013 +0200 Committer: Babak Vahdat <bvah...@apache.org> Committed: Sat Sep 28 20:51:32 2013 +0200 ---------------------------------------------------------------------- ...rtzConsumerTwoAppsClusteredFailoverTest.java | 108 +++++++++++++++++++ ...ringQuartzPersistentStoreRestartAppTest.java | 4 +- ...pringQuartzTwoAppsClusteredFailoverTest.java | 10 +- ...SpringQuartzConsumerClusteredAppDatabase.xml | 30 ++++++ .../SpringQuartzConsumerClusteredAppOne.xml | 73 +++++++++++++ .../SpringQuartzConsumerClusteredAppTwo.xml | 71 ++++++++++++ .../quartz/SpringQuartzClusteredAppDatabase.xml | 30 ++++++ .../quartz/SpringQuartzClusteredAppOne.xml | 75 +++++++++++++ .../quartz/SpringQuartzClusteredAppOneTest.xml | 75 ------------- .../quartz/SpringQuartzClusteredAppTwo.xml | 75 +++++++++++++ .../quartz/SpringQuartzClusteredAppTwoTest.xml | 75 ------------- .../quartz/SpringQuartzEmbeddedDatabase.xml | 30 ------ 12 files changed, 470 insertions(+), 186 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzConsumerTwoAppsClusteredFailoverTest.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzConsumerTwoAppsClusteredFailoverTest.java b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzConsumerTwoAppsClusteredFailoverTest.java new file mode 100644 index 0000000..3139950 --- /dev/null +++ b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzConsumerTwoAppsClusteredFailoverTest.java @@ -0,0 +1,108 @@ +/** + * 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; + +import org.apache.camel.CamelContext; +import org.apache.camel.Exchange; +import org.apache.camel.Predicate; +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.test.junit4.TestSupport; +import org.junit.Test; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +/** + * Tests a Quartz based cluster setup of two Camel Apps being triggered through {@link QuartzConsumer}. + * + * @version + */ +public class SpringQuartzConsumerTwoAppsClusteredFailoverTest extends TestSupport { + + @Test + public void testQuartzPersistentStoreClusteredApp() throws Exception { + // boot up the database the two apps are going to share inside a clustered quartz setup + AbstractXmlApplicationContext db = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppDatabase.xml"); + db.start(); + + // now launch the first clustered app + AbstractXmlApplicationContext app = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppOne.xml"); + app.start(); + + // as well as the second one + AbstractXmlApplicationContext app2 = new ClassPathXmlApplicationContext("org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppTwo.xml"); + app2.start(); + + CamelContext camel = app.getBean("camelContext", CamelContext.class); + + MockEndpoint mock = camel.getEndpoint("mock:result", MockEndpoint.class); + mock.expectedMinimumMessageCount(3); + mock.expectedMessagesMatches(new ClusteringPredicate(true)); + + // let the route run a bit... + Thread.sleep(5000); + + mock.assertIsSatisfied(); + + // now let's simulate a crash of the first app + log.warn("The first app is going to crash NOW!"); + app.close(); + + log.warn("Crashed..."); + log.warn("Crashed..."); + log.warn("Crashed..."); + + // wait long enough until the second app takes it over... + Thread.sleep(20000); + // inside the logs one can then clearly see how the route of the second CamelContext gets started: + // 2013-09-28 19:50:43,900 [main ] WARN ntTwoAppsClusteredFailoverTest - Crashed... + // 2013-09-28 19:50:43,900 [main ] WARN ntTwoAppsClusteredFailoverTest - Crashed... + // 2013-09-28 19:50:43,900 [main ] WARN ntTwoAppsClusteredFailoverTest - Crashed... + // 2013-09-28 19:50:58,892 [_ClusterManager] INFO LocalDataSourceJobStore - ClusterManager: detected 1 failed or restarted instances. + // 2013-09-28 19:50:58,892 [_ClusterManager] INFO LocalDataSourceJobStore - ClusterManager: Scanning for instance "app-one"'s failed in-progress jobs. + // 2013-09-28 19:50:58,913 [eduler_Worker-1] INFO triggered - Exchange[ExchangePattern: InOnly, BodyType: String, Body: clustering PONGS!] + + CamelContext camel2 = app2.getBean("camelContext", CamelContext.class); + + MockEndpoint mock2 = camel2.getEndpoint("mock:result", MockEndpoint.class); + mock2.expectedMinimumMessageCount(3); + mock2.expectedMessagesMatches(new ClusteringPredicate(false)); + + mock2.assertIsSatisfied(); + + // stop the second app as we're already done + app2.close(); + + // and as the last step shutdown the database... + db.close(); + } + + private static class ClusteringPredicate implements Predicate { + + private final String expectedPayload; + + ClusteringPredicate(boolean pings) { + expectedPayload = pings ? "clustering PINGS!" : "clustering PONGS!"; + } + + @Override + public boolean matches(Exchange exchange) { + return exchange.getIn().getBody().equals(expectedPayload); + } + + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppTest.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppTest.java b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppTest.java index 0dade60..dc008d6 100644 --- a/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppTest.java +++ b/components/camel-quartz/src/test/java/org/apache/camel/component/quartz/SpringQuartzPersistentStoreRestartAppTest.java @@ -71,9 +71,9 @@ public class SpringQuartzPersistentStoreRestartAppTest extends TestSupport { app2.stop(); - // we're done so let's properly close the application contexts, but stop + // we're done so let's properly close the application contexts, but close // the second app before the first one so that the quartz scheduler running - // inside it can properly be shutdown + // inside it can be properly shutdown app2.close(); app.close(); } http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SpringQuartzTwoAppsClusteredFailoverTest.java ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SpringQuartzTwoAppsClusteredFailoverTest.java b/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SpringQuartzTwoAppsClusteredFailoverTest.java index 2c0be7e..8d9fc4f 100644 --- a/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SpringQuartzTwoAppsClusteredFailoverTest.java +++ b/components/camel-quartz/src/test/java/org/apache/camel/routepolicy/quartz/SpringQuartzTwoAppsClusteredFailoverTest.java @@ -25,22 +25,24 @@ import org.springframework.context.support.AbstractXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; /** - * @version + * Tests a Quartz based cluster setup of two Camel Apps being triggered through {@link CronScheduledRoutePolicy}. + * + * @version */ public class SpringQuartzTwoAppsClusteredFailoverTest extends TestSupport { @Test public void testQuartzPersistentStoreClusteredApp() throws Exception { // boot up the database the two apps are going to share inside a clustered quartz setup - AbstractXmlApplicationContext db = new ClassPathXmlApplicationContext("org/apache/camel/routepolicy/quartz/SpringQuartzEmbeddedDatabase.xml"); + AbstractXmlApplicationContext db = new ClassPathXmlApplicationContext("org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppDatabase.xml"); db.start(); // now launch the first clustered app - AbstractXmlApplicationContext app = new ClassPathXmlApplicationContext("org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOneTest.xml"); + AbstractXmlApplicationContext app = new ClassPathXmlApplicationContext("org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOne.xml"); app.start(); // as well as the second one - AbstractXmlApplicationContext app2 = new ClassPathXmlApplicationContext("org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwoTest.xml"); + AbstractXmlApplicationContext app2 = new ClassPathXmlApplicationContext("org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwo.xml"); app2.start(); CamelContext camel = app.getBean("camelContext", CamelContext.class); http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppDatabase.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppDatabase.xml b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppDatabase.xml new file mode 100644 index 0000000..ebcd7c2 --- /dev/null +++ b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppDatabase.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> + + <!-- the embedded persistent storage for quartz --> + <jdbc:embedded-database id="quartz-db" type="DERBY"> + <jdbc:script location="classpath:tables_derby.sql"/> + </jdbc:embedded-database> + +</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppOne.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppOne.xml b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppOne.xml new file mode 100644 index 0000000..d7cc4c7 --- /dev/null +++ b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppOne.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource"> + <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" /> + <!-- refer the embedded database we setup inside SpringQuartzEmbeddedDatabase.xml --> + <property name="url" value="jdbc:derby:memory:quartz-db" /> + <property name="username" value="sa" /> + <property name="password" value="" /> + </bean> + + <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent"> + <property name="scheduler" ref="scheduler"/> + </bean> + + <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> + <property name="dataSource" ref="quartzDataSource"/> + <property name="autoStartup" value="false"/> + <property name="schedulerContextAsMap"> + <!-- hook Camel into Quartz --> + <map> + <!-- CamelJob makes use of the following key below to find the same Job as we failover to 'app-two' --> + <!-- QuartzConstants.QUARTZ_CAMEL_CONTEXT + "-" + camelContextName --> + <entry key="CamelQuartzCamelContext-camelContext" value-ref="camelContext"/> + </map> + </property> + <property name="quartzProperties"> + <props> + <prop key="org.quartz.scheduler.instanceName">myscheduler</prop> + <prop key="org.quartz.scheduler.instanceId">app-one</prop> + <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> + <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> + <prop key="org.quartz.jobStore.isClustered">true</prop> + <prop key="org.quartz.jobStore.clusterCheckinInterval">5000</prop> + </props> + </property> + </bean> + + <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"> + <template id="template" /> + <route id="myRoute"> + <from uri="quartz://app/test?trigger.repeatInterval=1000&trigger.repeatCount=-1" /> + <transform> + <simple>clustering PINGS!</simple> + </transform> + <to uri="log:triggered" /> + <to uri="mock:result" /> + </route> + </camelContext> + +</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppTwo.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppTwo.xml b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppTwo.xml new file mode 100644 index 0000000..a27161c --- /dev/null +++ b/components/camel-quartz/src/test/resources/org/apache/camel/component/quartz/SpringQuartzConsumerClusteredAppTwo.xml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource"> + <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" /> + <!-- refer the embedded database we setup inside SpringQuartzEmbeddedDatabase.xml --> + <property name="url" value="jdbc:derby:memory:quartz-db" /> + <property name="username" value="sa" /> + <property name="password" value="" /> + </bean> + + <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent"> + <property name="scheduler" ref="scheduler"/> + </bean> + + <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> + <property name="dataSource" ref="quartzDataSource"/> + <property name="autoStartup" value="false"/> + <property name="schedulerContextAsMap"> + <!-- hook Camel into Quartz --> + <map> + <entry key="CamelQuartzCamelContext-camelContext" value-ref="camelContext"/> + </map> + </property> + <property name="quartzProperties"> + <props> + <prop key="org.quartz.scheduler.instanceName">myscheduler</prop> + <prop key="org.quartz.scheduler.instanceId">app-two</prop> + <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> + <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> + <prop key="org.quartz.jobStore.isClustered">true</prop> + <prop key="org.quartz.jobStore.clusterCheckinInterval">5000</prop> + </props> + </property> + </bean> + + <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"> + <template id="template" /> + <route id="myRoute"> + <from uri="quartz://app/test?trigger.repeatInterval=1000&trigger.repeatCount=-1" /> + <transform> + <simple>clustering PONGS!</simple> + </transform> + <to uri="log:triggered" /> + <to uri="mock:result" /> + </route> + </camelContext> + +</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppDatabase.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppDatabase.xml b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppDatabase.xml new file mode 100644 index 0000000..ebcd7c2 --- /dev/null +++ b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppDatabase.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> + + <!-- the embedded persistent storage for quartz --> + <jdbc:embedded-database id="quartz-db" type="DERBY"> + <jdbc:script location="classpath:tables_derby.sql"/> + </jdbc:embedded-database> + +</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOne.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOne.xml b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOne.xml new file mode 100644 index 0000000..2936366 --- /dev/null +++ b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOne.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource"> + <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" /> + <!-- refer the embedded database we setup inside SpringQuartzEmbeddedDatabase.xml --> + <property name="url" value="jdbc:derby:memory:quartz-db" /> + <property name="username" value="sa" /> + <property name="password" value="" /> + </bean> + + <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent"> + <property name="scheduler" ref="scheduler"/> + </bean> + + <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> + <property name="dataSource" ref="quartzDataSource"/> + <property name="autoStartup" value="false"/> + <property name="schedulerContextAsMap"> + <!-- hook Camel into Quartz --> + <map> + <entry key="CamelQuartzCamelContext" value-ref="camelContext"/> + </map> + </property> + <property name="quartzProperties"> + <props> + <prop key="org.quartz.scheduler.instanceName">myscheduler</prop> + <prop key="org.quartz.scheduler.instanceId">app-one</prop> + <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> + <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> + <prop key="org.quartz.jobStore.isClustered">true</prop> + <prop key="org.quartz.jobStore.clusterCheckinInterval">5000</prop> + </props> + </property> + </bean> + + <bean id="startPolicy" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy"> + <property name="routeStartTime" value="0/3 * * * * ?" /> + </bean> + + <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"> + <template id="template" /> + <route id="myRoute" routePolicyRef="startPolicy" autoStartup="false"> + <from uri="direct:start" /> + <to uri="log:triggered" /> + <transform> + <simple>${body} PINGS!</simple> + </transform> + <to uri="mock:result" /> + </route> + </camelContext> + +</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOneTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOneTest.xml b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOneTest.xml deleted file mode 100644 index 2936366..0000000 --- a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppOneTest.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:jdbc="http://www.springframework.org/schema/jdbc" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource"> - <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" /> - <!-- refer the embedded database we setup inside SpringQuartzEmbeddedDatabase.xml --> - <property name="url" value="jdbc:derby:memory:quartz-db" /> - <property name="username" value="sa" /> - <property name="password" value="" /> - </bean> - - <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent"> - <property name="scheduler" ref="scheduler"/> - </bean> - - <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> - <property name="dataSource" ref="quartzDataSource"/> - <property name="autoStartup" value="false"/> - <property name="schedulerContextAsMap"> - <!-- hook Camel into Quartz --> - <map> - <entry key="CamelQuartzCamelContext" value-ref="camelContext"/> - </map> - </property> - <property name="quartzProperties"> - <props> - <prop key="org.quartz.scheduler.instanceName">myscheduler</prop> - <prop key="org.quartz.scheduler.instanceId">app-one</prop> - <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> - <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> - <prop key="org.quartz.jobStore.isClustered">true</prop> - <prop key="org.quartz.jobStore.clusterCheckinInterval">5000</prop> - </props> - </property> - </bean> - - <bean id="startPolicy" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy"> - <property name="routeStartTime" value="0/3 * * * * ?" /> - </bean> - - <camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring"> - <template id="template" /> - <route id="myRoute" routePolicyRef="startPolicy" autoStartup="false"> - <from uri="direct:start" /> - <to uri="log:triggered" /> - <transform> - <simple>${body} PINGS!</simple> - </transform> - <to uri="mock:result" /> - </route> - </camelContext> - -</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwo.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwo.xml b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwo.xml new file mode 100644 index 0000000..ef1993a --- /dev/null +++ b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwo.xml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource"> + <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" /> + <!-- refer the embedded database we setup inside SpringQuartzEmbeddedDatabase.xml --> + <property name="url" value="jdbc:derby:memory:quartz-db" /> + <property name="username" value="sa" /> + <property name="password" value="" /> + </bean> + + <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent"> + <property name="scheduler" ref="scheduler"/> + </bean> + + <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> + <property name="dataSource" ref="quartzDataSource"/> + <property name="autoStartup" value="false"/> + <property name="schedulerContextAsMap"> + <!-- hook Camel into Quartz --> + <map> + <entry key="CamelQuartzCamelContext" value-ref="camelContext2"/> + </map> + </property> + <property name="quartzProperties"> + <props> + <prop key="org.quartz.scheduler.instanceName">myscheduler</prop> + <prop key="org.quartz.scheduler.instanceId">app-two</prop> + <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> + <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> + <prop key="org.quartz.jobStore.isClustered">true</prop> + <prop key="org.quartz.jobStore.clusterCheckinInterval">5000</prop> + </props> + </property> + </bean> + + <bean id="startPolicy" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy"> + <property name="routeStartTime" value="0/3 * * * * ?" /> + </bean> + + <camelContext id="camelContext2" xmlns="http://camel.apache.org/schema/spring"> + <template id="template" /> + <route id="myRoute" routePolicyRef="startPolicy" autoStartup="false"> + <from uri="direct:start" /> + <to uri="log:triggered" /> + <transform> + <simple>${body} PONGS!</simple> + </transform> + <to uri="mock:result" /> + </route> + </camelContext> + +</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwoTest.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwoTest.xml b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwoTest.xml deleted file mode 100644 index ef1993a..0000000 --- a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzClusteredAppTwoTest.xml +++ /dev/null @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:jdbc="http://www.springframework.org/schema/jdbc" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd - http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> - - <bean id="quartzDataSource" class="org.apache.commons.dbcp.BasicDataSource"> - <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver" /> - <!-- refer the embedded database we setup inside SpringQuartzEmbeddedDatabase.xml --> - <property name="url" value="jdbc:derby:memory:quartz-db" /> - <property name="username" value="sa" /> - <property name="password" value="" /> - </bean> - - <bean id="quartz" class="org.apache.camel.component.quartz.QuartzComponent"> - <property name="scheduler" ref="scheduler"/> - </bean> - - <bean id="scheduler" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> - <property name="dataSource" ref="quartzDataSource"/> - <property name="autoStartup" value="false"/> - <property name="schedulerContextAsMap"> - <!-- hook Camel into Quartz --> - <map> - <entry key="CamelQuartzCamelContext" value-ref="camelContext2"/> - </map> - </property> - <property name="quartzProperties"> - <props> - <prop key="org.quartz.scheduler.instanceName">myscheduler</prop> - <prop key="org.quartz.scheduler.instanceId">app-two</prop> - <prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> - <prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> - <prop key="org.quartz.jobStore.isClustered">true</prop> - <prop key="org.quartz.jobStore.clusterCheckinInterval">5000</prop> - </props> - </property> - </bean> - - <bean id="startPolicy" class="org.apache.camel.routepolicy.quartz.CronScheduledRoutePolicy"> - <property name="routeStartTime" value="0/3 * * * * ?" /> - </bean> - - <camelContext id="camelContext2" xmlns="http://camel.apache.org/schema/spring"> - <template id="template" /> - <route id="myRoute" routePolicyRef="startPolicy" autoStartup="false"> - <from uri="direct:start" /> - <to uri="log:triggered" /> - <transform> - <simple>${body} PONGS!</simple> - </transform> - <to uri="mock:result" /> - </route> - </camelContext> - -</beans> http://git-wip-us.apache.org/repos/asf/camel/blob/15e0c6d8/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzEmbeddedDatabase.xml ---------------------------------------------------------------------- diff --git a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzEmbeddedDatabase.xml b/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzEmbeddedDatabase.xml deleted file mode 100644 index ebcd7c2..0000000 --- a/components/camel-quartz/src/test/resources/org/apache/camel/routepolicy/quartz/SpringQuartzEmbeddedDatabase.xml +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - 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. ---> -<beans xmlns="http://www.springframework.org/schema/beans" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:jdbc="http://www.springframework.org/schema/jdbc" - xsi:schemaLocation=" - http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd - http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc.xsd"> - - <!-- the embedded persistent storage for quartz --> - <jdbc:embedded-database id="quartz-db" type="DERBY"> - <jdbc:script location="classpath:tables_derby.sql"/> - </jdbc:embedded-database> - -</beans>