Added: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateRecoverWithRedeliveryPolicyTest.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateRecoverWithRedeliveryPolicyTest.xml?rev=1055799&view=auto ============================================================================== --- camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateRecoverWithRedeliveryPolicyTest.xml (added) +++ camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateRecoverWithRedeliveryPolicyTest.xml Thu Jan 6 09:24:11 2011 @@ -0,0 +1,62 @@ +<?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:ctx="http://www.springframework.org/schema/context" + xmlns:util="http://www.springframework.org/schema/util" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <import resource="JdbcSpringDataSource.xml" /> + + <bean id="repoQuickRecovery" parent="repo1"> + <!-- scan 2 times per second --> + <property name="recoveryInterval" value="500"/> + <!-- enable recovery --> + <property name="useRecovery" value="true"/> + </bean> + + <!-- aggregate the messages using this strategy --> + <bean id="myAggregatorStrategy" class="org.apache.camel.component.jdbc.aggregationrepository.JdbcSpringAggregateRecoverWithRedeliveryPolicyTest$MyAggregationStrategy"/> + + <!-- and use this processor to simulate errors --> + <bean id="myFailProcessor" class="org.apache.camel.component.jdbc.aggregationrepository.JdbcSpringAggregateRecoverWithRedeliveryPolicyTest$MyFailProcessor"/> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" trace="true"> + <route> + <from uri="direct:start"/> + <!-- aggregate using our strategy and jdbc repo, and complete when we have 5 messages aggregated --> + <aggregate strategyRef="myAggregatorStrategy" aggregationRepositoryRef="repoQuickRecovery" completionSize="5"> + <!-- correlate by header with the key id --> + <correlationExpression><header>id</header></correlationExpression> + <!-- send aggregated messages out here --> + <to uri="mock:aggregated"/> + <!-- this processor will fail the first 2 attempts --> + <process ref="myFailProcessor"/> + <!-- at the 3rd attempt we should be able to send to this mock result endpoint --> + <to uri="mock:result"/> + </aggregate> + </route> + </camelContext> + +</beans> \ No newline at end of file
Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateRecoverWithRedeliveryPolicyTest.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateRecoverWithRedeliveryPolicyTest.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateRecoverWithRedeliveryPolicyTest.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateTest.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateTest.xml?rev=1055799&view=auto ============================================================================== --- camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateTest.xml (added) +++ camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateTest.xml Thu Jan 6 09:24:11 2011 @@ -0,0 +1,48 @@ +<?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:ctx="http://www.springframework.org/schema/context" + xmlns:util="http://www.springframework.org/schema/util" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> + + <import resource="JdbcSpringDataSource.xml" /> + + <!-- aggregate the messages using this strategy --> + <bean id="myAggregatorStrategy" class="org.apache.camel.component.jdbc.aggregationrepository.JdbcSpringAggregateTest$MyAggregationStrategy"/> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring" trace="true"> + <route> + <from uri="direct:start"/> + <!-- aggregate using our strategy and jdbc repo, and complete when we have 5 messages aggregated --> + <aggregate strategyRef="myAggregatorStrategy" aggregationRepositoryRef="repo1" completionSize="5"> + <!-- correlate by header with the key id --> + <correlationExpression><header>id</header></correlationExpression> + <!-- send aggregated messages to the mock endpoint --> + <to uri="mock:aggregated"/> + </aggregate> + </route> + </camelContext> + +</beans> \ No newline at end of file Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateTest.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateTest.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringAggregateTest.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringDataSource.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringDataSource.xml?rev=1055799&view=auto ============================================================================== --- camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringDataSource.xml (added) +++ camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringDataSource.xml Thu Jan 6 09:24:11 2011 @@ -0,0 +1,67 @@ +<?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:ctx="http://www.springframework.org/schema/context" + xmlns:util="http://www.springframework.org/schema/util" + xmlns:jdbc="http://www.springframework.org/schema/jdbc" + xmlns:tx="http://www.springframework.org/schema/tx" + xmlns:aop="http://www.springframework.org/schema/aop" + xsi:schemaLocation=" + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd + http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd + http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd + http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> + + <tx:annotation-driven transaction-manager="txManager"/> + + <!-- In Memory Database #1 --> + <jdbc:embedded-database id="dataSource1" type="H2"> + <jdbc:script location="classpath:/sql/init.sql"/> + </jdbc:embedded-database> + + <!-- In Memory Database #2 --> + <jdbc:embedded-database id="dataSource2" type="H2"> + <jdbc:script location="classpath:/sql/init2.sql"/> + </jdbc:embedded-database> + + <bean id="repo1" class="org.apache.camel.component.jdbc.aggregationrepository.JdbcAggregationRepository"> + <constructor-arg ref="txManager1" /> + <constructor-arg value="aggregationRepo1" /> + <constructor-arg ref="dataSource1" /> + </bean> + + <bean id="repo2" class="org.apache.camel.component.jdbc.aggregationrepository.JdbcAggregationRepository"> + <constructor-arg ref="txManager2" /> + <constructor-arg value="aggregationRepo2" /> + <constructor-arg ref="dataSource2" /> + </bean> + + <bean id="txManager1" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> + <property name="dataSource" ref="dataSource1"/> + </bean> + + <bean id="txManager2" class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> + <property name="dataSource" ref="dataSource2"/> + </bean> + +</beans> \ No newline at end of file Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringDataSource.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringDataSource.xml ------------------------------------------------------------------------------ svn:keywords = Rev Date Propchange: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/org/apache/camel/component/jdbc/aggregationrepository/JdbcSpringDataSource.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init.sql URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init.sql?rev=1055799&view=auto ============================================================================== --- camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init.sql (added) +++ camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init.sql Thu Jan 6 09:24:11 2011 @@ -0,0 +1,12 @@ +DROP TABLE aggregationRepo1 IF EXISTS; +DROP TABLE aggregationRepo1_completed IF EXISTS; +CREATE TABLE aggregationRepo1 ( + id varchar(255) NOT NULL, + exchange blob NOT NULL, + constraint aggregationRepo1_pk PRIMARY KEY (id) +); +CREATE TABLE aggregationRepo1_completed ( + id varchar(255) NOT NULL, + exchange blob NOT NULL, + constraint aggregationRepo1_completed_pk PRIMARY KEY (id) +); \ No newline at end of file Added: camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init2.sql URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init2.sql?rev=1055799&view=auto ============================================================================== --- camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init2.sql (added) +++ camel/trunk/components/camel-jdbc-aggregator/src/test/resources/sql/init2.sql Thu Jan 6 09:24:11 2011 @@ -0,0 +1,12 @@ +DROP TABLE aggregationRepo2 IF EXISTS; +DROP TABLE aggregationRepo2_completed IF EXISTS; +CREATE TABLE aggregationRepo2 ( + id varchar(255) NOT NULL, + exchange blob NOT NULL, + constraint aggregationRepo2_pk PRIMARY KEY (id) +); +CREATE TABLE aggregationRepo2_completed ( + id varchar(255) NOT NULL, + exchange blob NOT NULL, + constraint aggregationRepo2_completed_pk PRIMARY KEY (id) +); \ No newline at end of file Modified: camel/trunk/components/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/components/pom.xml?rev=1055799&r1=1055798&r2=1055799&view=diff ============================================================================== --- camel/trunk/components/pom.xml (original) +++ camel/trunk/components/pom.xml Thu Jan 6 09:24:11 2011 @@ -68,6 +68,7 @@ <module>camel-jaxb</module> <module>camel-jibx</module> <module>camel-jdbc</module> + <module>camel-jdbc-aggregator</module> <module>camel-jetty</module> <module>camel-jing</module> <module>camel-jms</module> Modified: camel/trunk/parent/pom.xml URL: http://svn.apache.org/viewvc/camel/trunk/parent/pom.xml?rev=1055799&r1=1055798&r2=1055799&view=diff ============================================================================== --- camel/trunk/parent/pom.xml (original) +++ camel/trunk/parent/pom.xml Thu Jan 6 09:24:11 2011 @@ -73,6 +73,7 @@ <geronimo-servlet-spec-version>1.1.1</geronimo-servlet-spec-version> <groovy-version>1.7.6</groovy-version> <guiceyfruit-version>2.0</guiceyfruit-version> + <h2-version>1.2.144</h2-version> <hamcrest-version>1.2-dev1</hamcrest-version> <hawtbuf-version>1.2</hawtbuf-version> <hawtdb-version>1.5</hawtdb-version> @@ -403,6 +404,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-jdbc-aggregator</artifactId> + <version>${project.version}</version> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-jetty</artifactId> <version>${project.version}</version> </dependency> @@ -1284,6 +1290,11 @@ <artifactId>hsqldb</artifactId> <version>${hsqldb-version}</version> </dependency> + <dependency> + <groupId>com.h2database</groupId> + <artifactId>h2</artifactId> + <version>${h2-version}</version> + </dependency> <!-- optional SNMP4J --> <dependency> Modified: camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml?rev=1055799&r1=1055798&r2=1055799&view=diff ============================================================================== --- camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml (original) +++ camel/trunk/platforms/karaf/features/src/main/resources/features-spring2.xml Thu Jan 6 09:24:11 2011 @@ -365,6 +365,13 @@ <feature version='${pom.version}'>camel-core</feature> <bundle>mvn:org.apache.camel/camel-jdbc/${pom.version}</bundle> </feature> + <feature name='camel-jdbc-aggregator' version='${pom.version}'> + <bundle>mvn:org.springframework/spring-core/${spring-version}</bundle> + <bundle>mvn:org.springframework/spring-tx/${spring-version}</bundle> + <feature version='${pom.version}'>camel-core</feature> + <bundle>mvn:org.springframework/spring-jdbc/${spring-version}</bundle> + <bundle>mvn:org.apache.camel/camel-jdbc-aggregator/${pom.version}</bundle> + </feature> <feature name='camel-jing' version='${pom.version}'> <feature version='${pom.version}'>camel-spring</feature> <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.ant/${ant-bundle-version}</bundle> Modified: camel/trunk/platforms/karaf/features/src/main/resources/features.xml URL: http://svn.apache.org/viewvc/camel/trunk/platforms/karaf/features/src/main/resources/features.xml?rev=1055799&r1=1055798&r2=1055799&view=diff ============================================================================== --- camel/trunk/platforms/karaf/features/src/main/resources/features.xml (original) +++ camel/trunk/platforms/karaf/features/src/main/resources/features.xml Thu Jan 6 09:24:11 2011 @@ -375,6 +375,13 @@ <feature version='${pom.version}'>camel-core</feature> <bundle>mvn:org.apache.camel/camel-jdbc/${pom.version}</bundle> </feature> + <feature name='camel-jdbc-aggregator' version='${pom.version}'> + <bundle>mvn:org.springframework/spring-core/${spring3-version}</bundle> + <bundle>mvn:org.springframework/spring-tx/${spring3-version}</bundle> + <feature version='${pom.version}'>camel-core</feature> + <bundle>mvn:org.springframework/spring-jdbc/${spring3-version}</bundle> + <bundle>mvn:org.apache.camel/camel-jdbc-aggregator/${pom.version}</bundle> + </feature> <feature name='camel-josql' version='${pom.version}'> <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.josql/${josql-bundle-version}</bundle> <feature version='${pom.version}'>camel-core</feature> Copied: camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJdbcAggregatorTest.java (from r1055783, camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJdbcTest.java) URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJdbcAggregatorTest.java?p2=camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJdbcAggregatorTest.java&p1=camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJdbcTest.java&r1=1055783&r2=1055799&rev=1055799&view=diff ============================================================================== --- camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJdbcTest.java (original) +++ camel/trunk/tests/camel-itest-karaf/src/test/java/org/apache/camel/itest/karaf/CamelJdbcAggregatorTest.java Thu Jan 6 09:24:11 2011 @@ -23,9 +23,9 @@ import org.ops4j.pax.exam.junit.Configur import org.ops4j.pax.exam.junit.JUnit4TestRunner; @RunWith(JUnit4TestRunner.class) -public class CamelJdbcTest extends AbstractFeatureTest { +public class CamelJdbcAggregatorTest extends AbstractFeatureTest { - public static final String COMPONENT = extractName(CamelJdbcTest.class); + public static final String COMPONENT = extractName(CamelJdbcAggregatorTest.class); @Test public void test() throws Exception {