-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[resolves #1138] Add support for spring-context-support
- Loading branch information
Martin Basovnik
authored and
Thomas Diesler
committed
Mar 14, 2016
1 parent
b8cff5b
commit 543797f
Showing
14 changed files
with
389 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
.../resources/modules/system/layers/fuse/org/springframework/context-support/main/module.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module xmlns="urn:jboss:module:1.1" name="org.springframework.context-support"> | ||
<properties> | ||
<property name="jboss.api" value="private" /> | ||
</properties> | ||
<resources> | ||
<artifact name="${org.springframework:spring-context-support}" /> | ||
</resources> | ||
<dependencies> | ||
<module name="javax.api" /> | ||
<module name="org.apache.commons.logging" /> | ||
<module name="org.springframework.tx" optional="true" /> | ||
<module name="org.springframework.jdbc" optional="true" /> | ||
<module name="org.quartz" optional="true" /> | ||
<module name="org.springframework.beans" /> | ||
<module name="org.springframework.context" /> | ||
<module name="org.springframework.core" /> | ||
</dependencies> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
...andalone/basic/src/main/java/org/wildfly/camel/test/quartz/QuartzPersistentStoreTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* #%L | ||
* Wildfly Camel :: Testsuite | ||
* %% | ||
* Copyright (C) 2013 - 2014 RedHat | ||
* %% | ||
* Licensed 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. | ||
* #L% | ||
*/ | ||
|
||
package org.wildfly.camel.test.quartz; | ||
|
||
import org.apache.camel.CamelContext; | ||
import org.apache.camel.component.mock.MockEndpoint; | ||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.arquillian.test.api.ArquillianResource; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.wildfly.extension.camel.CamelAware; | ||
import org.wildfly.extension.camel.CamelConstants; | ||
import org.wildfly.extension.camel.CamelContextRegistry; | ||
|
||
@CamelAware | ||
@RunWith(Arquillian.class) | ||
public class QuartzPersistentStoreTest { | ||
|
||
@ArquillianResource | ||
CamelContextRegistry contextRegistry; | ||
|
||
@Deployment | ||
public static JavaArchive deployment() { | ||
final JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "quartz-tests"); | ||
archive.addAsManifestResource("quartz/quartz-camel-context.xml", CamelConstants.CAMEL_CONTEXT_FILE_NAME); | ||
archive.addAsResource("quartz/sql/db-schema.sql", "db-schema.sql"); | ||
return archive; | ||
} | ||
|
||
@Test | ||
public void restartRouteTest() throws Exception { | ||
CamelContext camelctx = contextRegistry.getCamelContext("quartz-context"); | ||
Assert.assertNotNull(camelctx); | ||
|
||
MockEndpoint mockEndpoint = camelctx.getEndpoint("mock:result", MockEndpoint.class); | ||
mockEndpoint.expectedMinimumMessageCount(2); | ||
|
||
mockEndpoint.assertIsSatisfied(); | ||
|
||
// restart route | ||
camelctx.stopRoute("myRoute"); | ||
mockEndpoint.reset(); | ||
mockEndpoint.expectedMessageCount(0); | ||
|
||
// wait a bit | ||
Thread.sleep(2000); | ||
|
||
mockEndpoint.assertIsSatisfied(); | ||
|
||
// start route, and we got messages again | ||
mockEndpoint.reset(); | ||
mockEndpoint.expectedMinimumMessageCount(2); | ||
|
||
camelctx.startRoute("myRoute"); | ||
|
||
mockEndpoint.assertIsSatisfied(); | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
itests/standalone/basic/src/main/resources/quartz/quartz-camel-context.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- | ||
#%L | ||
Wildfly Camel :: Testsuite | ||
%% | ||
Copyright (C) 2013 - 2015 RedHat | ||
%% | ||
Licensed 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. | ||
#L% | ||
--> | ||
<beans xmlns:jdbc="http://www.springframework.org/schema/jdbc" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="http://www.springframework.org/schema/beans" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | ||
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd | ||
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd"> | ||
|
||
<jdbc:embedded-database id="quartzDataSource" type="H2"> | ||
<jdbc:script location="db-schema.sql"/> | ||
</jdbc:embedded-database> | ||
|
||
<bean id="myScheduler" 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="quartz-context"/> | ||
</map> | ||
</property> | ||
<property name="quartzProperties"> | ||
<props> | ||
<prop key="org.quartz.scheduler.instanceName">myscheduler</prop> | ||
<prop key="org.quartz.scheduler.instanceId">AUTO</prop> | ||
<prop key="org.quartz.scheduler.skipUpdateCheck">true</prop> | ||
<prop key="org.terracotta.quartz.skipUpdateCheck">true</prop> | ||
<prop key="org.quartz.jobStore.driverDelegateClass">org.quartz.impl.jdbcjobstore.StdJDBCDelegate</prop> | ||
<prop key="org.quartz.jobStore.isClustered">false</prop> | ||
</props> | ||
</property> | ||
</bean> | ||
|
||
<bean id="quartz2" class="org.apache.camel.component.quartz2.QuartzComponent"> | ||
<property name="scheduler" ref="myScheduler"/> | ||
</bean> | ||
|
||
<camelContext id="quartz-context" xmlns="http://camel.apache.org/schema/spring"> | ||
<route id="myRoute"> | ||
<from uri="quartz2://app/test?trigger.repeatInterval=1000&trigger.repeatCount=-1&stateful=true"/> | ||
<log message="Fired: ${header.CamelCreatedTimestamp}"/> | ||
<to uri="mock:result"/> | ||
</route> | ||
</camelContext> | ||
|
||
</beans> |
130 changes: 130 additions & 0 deletions
130
itests/standalone/basic/src/main/resources/quartz/sql/db-schema.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
-- Tables for Quartz | ||
|
||
create table if not exists qrtz_job_details ( | ||
sched_name varchar(120) not null, | ||
job_name varchar(200) not null, | ||
job_group varchar(200) not null, | ||
description varchar(250) , | ||
job_class_name varchar(250) not null, | ||
is_durable varchar(5) not null, | ||
is_nonconcurrent varchar(5) not null, | ||
is_update_data varchar(5) not null, | ||
requests_recovery varchar(5) not null, | ||
job_data blob, | ||
primary key (sched_name,job_name,job_group) | ||
); | ||
|
||
create table if not exists qrtz_triggers ( | ||
sched_name varchar(120) not null, | ||
trigger_name varchar(200) not null, | ||
trigger_group varchar(200) not null, | ||
job_name varchar(200) not null, | ||
job_group varchar(200) not null, | ||
description varchar(250), | ||
next_fire_time bigint, | ||
prev_fire_time bigint, | ||
priority integer, | ||
trigger_state varchar(16) not null, | ||
trigger_type varchar(8) not null, | ||
start_time bigint not null, | ||
end_time bigint, | ||
calendar_name varchar(200), | ||
misfire_instr smallint, | ||
job_data blob, | ||
primary key (sched_name,trigger_name,trigger_group), | ||
foreign key (sched_name,job_name,job_group) references qrtz_job_details(sched_name,job_name,job_group) | ||
); | ||
|
||
create table if not exists qrtz_simple_triggers ( | ||
sched_name varchar(120) not null, | ||
trigger_name varchar(200) not null, | ||
trigger_group varchar(200) not null, | ||
repeat_count bigint not null, | ||
repeat_interval bigint not null, | ||
times_triggered bigint not null, | ||
primary key (sched_name,trigger_name,trigger_group), | ||
foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group) | ||
); | ||
|
||
create table if not exists qrtz_cron_triggers ( | ||
sched_name varchar(120) not null, | ||
trigger_name varchar(200) not null, | ||
trigger_group varchar(200) not null, | ||
cron_expression varchar(120) not null, | ||
time_zone_id varchar(80), | ||
primary key (sched_name,trigger_name,trigger_group), | ||
foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group) | ||
); | ||
|
||
create table if not exists qrtz_simprop_triggers ( | ||
sched_name varchar(120) not null, | ||
trigger_name varchar(200) not null, | ||
trigger_group varchar(200) not null, | ||
str_prop_1 varchar(512), | ||
str_prop_2 varchar(512), | ||
str_prop_3 varchar(512), | ||
int_prop_1 int, | ||
int_prop_2 int, | ||
long_prop_1 bigint, | ||
long_prop_2 bigint, | ||
dec_prop_1 numeric(13,4), | ||
dec_prop_2 numeric(13,4), | ||
bool_prop_1 varchar(5), | ||
bool_prop_2 varchar(5), | ||
primary key (sched_name,trigger_name,trigger_group), | ||
foreign key (sched_name,trigger_name,trigger_group) | ||
references qrtz_triggers(sched_name,trigger_name,trigger_group) | ||
); | ||
|
||
create table if not exists qrtz_blob_triggers ( | ||
sched_name varchar(120) not null, | ||
trigger_name varchar(200) not null, | ||
trigger_group varchar(200) not null, | ||
blob_data blob, | ||
primary key (sched_name,trigger_name,trigger_group), | ||
foreign key (sched_name,trigger_name,trigger_group) references qrtz_triggers(sched_name,trigger_name,trigger_group) | ||
); | ||
|
||
create table if not exists qrtz_calendars ( | ||
sched_name varchar(120) not null, | ||
calendar_name varchar(200) not null, | ||
calendar blob not null, | ||
primary key (sched_name,calendar_name) | ||
); | ||
|
||
create table if not exists qrtz_paused_trigger_grps ( | ||
sched_name varchar(120) not null, | ||
trigger_group varchar(200) not null, | ||
primary key (sched_name,trigger_group) | ||
); | ||
|
||
create table if not exists qrtz_fired_triggers ( | ||
sched_name varchar(120) not null, | ||
entry_id varchar(95) not null, | ||
trigger_name varchar(200) not null, | ||
trigger_group varchar(200) not null, | ||
instance_name varchar(200) not null, | ||
fired_time bigint not null, | ||
sched_time bigint not null, | ||
priority integer not null, | ||
state varchar(16) not null, | ||
job_name varchar(200), | ||
job_group varchar(200), | ||
is_nonconcurrent varchar(5), | ||
requests_recovery varchar(5), | ||
primary key (sched_name,entry_id) | ||
); | ||
|
||
create table if not exists qrtz_scheduler_state ( | ||
sched_name varchar(120) not null, | ||
instance_name varchar(200) not null, | ||
last_checkin_time bigint not null, | ||
checkin_interval bigint not null, | ||
primary key (sched_name,instance_name) | ||
); | ||
|
||
create table if not exists qrtz_locks ( | ||
sched_name varchar(120) not null, | ||
lock_name varchar(40) not null, | ||
primary key (sched_name,lock_name) | ||
); |
Oops, something went wrong.