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 2010/01/05 20:18:56 UTC
svn commit: r896185 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/model/
components/camel-spring/src/main/java/org/apache/camel/spring/
tests/camel-itest/
tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/
tests/camel-itest/s...
Author: davsclaus
Date: Tue Jan 5 19:18:54 2010
New Revision: 896185
URL: http://svn.apache.org/viewvc?rev=896185&view=rev
Log:
CAMEL-2336: Fixed issue with Spring XML routes could in some cases loose cross cutting concerns such as error handling, transacted etc. CAMEL-2059: Added a bunch of itests to verify this fix as well. The Java DSL always worked.
Added:
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTable.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTableImpl.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/ExceptionRethrower.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/LoggingPipelineTest.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTagTest.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedFullExampleTest.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedPipelineTest.java (with props)
camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedTryCatchTest.java (with props)
camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml (with props)
camel/trunk/tests/camel-itest/src/test/resources/table.xml (with props)
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
camel/trunk/tests/camel-itest/pom.xml
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptDefinition.java Tue Jan 5 19:18:54 2010
@@ -66,6 +66,11 @@
}
@Override
+ public boolean isAbstract() {
+ return true;
+ }
+
+ @Override
public Processor createProcessor(final RouteContext routeContext) throws Exception {
// create the output processor
output = createOutputsProcessor(routeContext);
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptFromDefinition.java Tue Jan 5 19:18:54 2010
@@ -63,6 +63,11 @@
}
@Override
+ public boolean isAbstract() {
+ return true;
+ }
+
+ @Override
@SuppressWarnings("unchecked")
public Processor createProcessor(RouteContext routeContext) throws Exception {
// insert a set header definition so we can set the intercepted endpoint uri as a header
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/InterceptSendToEndpointDefinition.java Tue Jan 5 19:18:54 2010
@@ -75,6 +75,11 @@
}
@Override
+ public boolean isAbstract() {
+ return true;
+ }
+
+ @Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
// create the detour
final Processor detour = routeContext.createProcessor(this);
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java Tue Jan 5 19:18:54 2010
@@ -70,6 +70,11 @@
}
@Override
+ public boolean isAbstract() {
+ return true;
+ }
+
+ @Override
public Processor createProcessor(RouteContext routeContext) throws Exception {
Processor childProcessor = createOutputsProcessor(routeContext);
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/OnExceptionDefinition.java Tue Jan 5 19:18:54 2010
@@ -103,6 +103,11 @@
return "OnException[" + getExceptionClasses() + (onWhen != null ? " " + onWhen : "") + " -> " + getOutputs() + "]";
}
+ @Override
+ public boolean isAbstract() {
+ return true;
+ }
+
/**
* Allows an exception handler to create a new redelivery policy for this exception type
* @param context the camel context
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/PolicyDefinition.java Tue Jan 5 19:18:54 2010
@@ -76,6 +76,11 @@
}
}
+ @Override
+ public boolean isAbstract() {
+ return true;
+ }
+
public String getRef() {
return ref;
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/ProcessorDefinition.java Tue Jan 5 19:18:54 2010
@@ -87,6 +87,27 @@
// else to use an optional attribute in JAXB2
public abstract List<ProcessorDefinition> getOutputs();
+ /**
+ * Whether this model is abstract or not.
+ * <p/>
+ * An abstract model is something that is used for configuring cross cutting concerns such as
+ * error handling, transaction policies, interceptors etc.
+ * <p/>
+ * Regular definitions is what is part of the route, such as ToDefinition, WireTapDefinition and the likes.
+ * <p/>
+ * Will by default return <tt>false</tt> to indicate regular definition, so all the abstract definitions
+ * must override this method and return <tt>true</tt> instead.
+ * <p/>
+ * This information is used in camel-spring to let Camel work a bit on the model provided by JAXB from the
+ * Spring XML file. This is needed to handle those cross cutting concerns properly. The Java DSL does not
+ * have this issue as it can work this out directly using the fluent builder methods.
+ *
+ * @return <tt>true</tt> for abstract, otherwise <tt>false</tt> for regular.
+ */
+ public boolean isAbstract() {
+ return false;
+ }
+
public Processor createProcessor(RouteContext routeContext) throws Exception {
throw new UnsupportedOperationException("Not implemented yet for class: " + getClass().getName());
}
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/model/TransactedDefinition.java Tue Jan 5 19:18:54 2010
@@ -86,6 +86,11 @@
}
}
+ @Override
+ public boolean isAbstract() {
+ return true;
+ }
+
public String getRef() {
return ref;
}
Modified: camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java (original)
+++ camel/trunk/components/camel-spring/src/main/java/org/apache/camel/spring/CamelContextFactoryBean.java Tue Jan 5 19:18:54 2010
@@ -305,16 +305,23 @@
// this is needed as JAXB does not build exactly the same model definition as Spring DSL would do
// using route builders. So we have here a little custom code to fix the JAXB gaps
for (RouteDefinition route : routes) {
- // interceptors should be first
+
+ // move all abstracts into their own list so we can deal with them separately
+ List<ProcessorDefinition> abstracts = new ArrayList<ProcessorDefinition>();
+ initAbstracts(route, abstracts);
+
+ // toAsync should fix up itself at first
+ initToAsync(route);
+
+ // interceptors should be first for the cross cutting concerns
initInterceptors(route);
// then on completion
- initOnCompletions(route);
+ initOnCompletions(route, abstracts);
// then polices
- initPolicies(route);
+ initPolicies(route, abstracts);
// then on exception
- initOnExceptions(route);
- // and then for toAsync
- initToAsync(route);
+ initOnExceptions(route, abstracts);
+
// configure parents
initParent(route);
}
@@ -382,34 +389,38 @@
route.getOutputs().addAll(outputs);
}
- private void initOnExceptions(RouteDefinition route) {
- List<ProcessorDefinition> outputs = new ArrayList<ProcessorDefinition>();
- List<ProcessorDefinition> exceptionHandlers = new ArrayList<ProcessorDefinition>();
+ private void initOnExceptions(RouteDefinition route, List<ProcessorDefinition> abstracts) {
// add global on exceptions if any
if (onExceptions != null && !onExceptions.isEmpty()) {
- // on exceptions must be added at top, so the route flow is correct as
- // on exceptions should be the first outputs
- route.getOutputs().addAll(0, onExceptions);
+ abstracts.addAll(onExceptions);
}
- for (ProcessorDefinition output : route.getOutputs()) {
- // split into on exception and regular outputs
+ // now add onExceptions to the route
+ for (ProcessorDefinition output : abstracts) {
if (output instanceof OnExceptionDefinition) {
- exceptionHandlers.add(output);
- } else {
- outputs.add(output);
+ // on exceptions must be added at top, so the route flow is correct as
+ // on exceptions should be the first outputs
+ route.getOutputs().add(0, output);
}
}
+ }
- // clearing the outputs
- route.clearOutput();
+ private void initAbstracts(RouteDefinition route, List<ProcessorDefinition> abstracts) {
+ List<ProcessorDefinition> retains = new ArrayList<ProcessorDefinition>();
- // add exception handlers as top children
- route.getOutputs().addAll(exceptionHandlers);
+ for (ProcessorDefinition output : route.getOutputs()) {
+ if (output.isAbstract()) {
+ abstracts.add(output);
+ } else {
+ retains.add(output);
+ }
+ }
- // and the remaining outputs
- route.getOutputs().addAll(outputs);
+ route.clearOutput();
+ for (ProcessorDefinition retain : retains) {
+ route.addOutput(retain);
+ }
}
private void initInterceptors(RouteDefinition route) {
@@ -455,61 +466,65 @@
}
- private void initOnCompletions(RouteDefinition route) {
- // only add global onCompletion if there are no route already
- boolean hasRouteScope = false;
- for (ProcessorDefinition out : route.getOutputs()) {
+ private void initOnCompletions(RouteDefinition route, List<ProcessorDefinition> abstracts) {
+ List<OnCompletionDefinition> completions = new ArrayList<OnCompletionDefinition>();
+
+ // find the route scoped onCompletions
+ for (ProcessorDefinition out : abstracts) {
if (out instanceof OnCompletionDefinition) {
- hasRouteScope = true;
- break;
+ completions.add((OnCompletionDefinition) out);
}
}
- // only add global onCompletion if we do *not* have any route onCompletion defined in the route
- // add onCompletion *after* intercept, as its important intercept is first
- if (!hasRouteScope) {
- int index = 0;
- for (int i = 0; i < route.getOutputs().size(); i++) {
- index = i;
- ProcessorDefinition out = route.getOutputs().get(i);
- if (out instanceof InterceptDefinition || out instanceof InterceptSendToEndpointDefinition) {
- continue;
- } else {
- // we found the spot
- break;
- }
+
+ // only add global onCompletion if there are no route already
+ if (completions.isEmpty()) {
+ completions = getOnCompletions();
+ }
+
+ // are there any completions to init at all?
+ if (completions.isEmpty()) {
+ return;
+ }
+
+ // add onCompletion *after* intercept, as its important intercept is first
+ int index = 0;
+ for (int i = 0; i < route.getOutputs().size(); i++) {
+ index = i;
+ ProcessorDefinition out = route.getOutputs().get(i);
+ if (out instanceof InterceptDefinition || out instanceof InterceptSendToEndpointDefinition) {
+ continue;
+ } else {
+ // we found the spot
+ break;
}
- route.getOutputs().addAll(index, getOnCompletions());
}
+ route.getOutputs().addAll(index, completions);
}
- private void initPolicies(RouteDefinition route) {
- // setup the policies as JAXB yet again have not created a correct model for us
- List<ProcessorDefinition> types = route.getOutputs();
-
+ private void initPolicies(RouteDefinition route, List<ProcessorDefinition> abstracts) {
// we need two types as transacted cannot extend policy due JAXB limitations
PolicyDefinition policy = null;
TransactedDefinition transacted = null;
// add to correct type
- for (ProcessorDefinition type : types) {
+ for (ProcessorDefinition type : abstracts) {
if (type instanceof PolicyDefinition) {
policy = (PolicyDefinition) type;
} else if (type instanceof TransactedDefinition) {
transacted = (TransactedDefinition) type;
- } else if (policy != null) {
- // the outputs should be moved to the policy
- policy.addOutput(type);
- } else if (transacted != null) {
- // the outputs should be moved to the transacted policy
- transacted.addOutput(type);
}
}
- // did we find a policy if so replace it as the only output on the route
if (policy != null) {
+ // the outputs should be moved to the policy
+ policy.getOutputs().addAll(route.getOutputs());
+ // and add it as the single output
route.clearOutput();
route.addOutput(policy);
} else if (transacted != null) {
+ // the outputs should be moved to the transacted policy
+ transacted.getOutputs().addAll(route.getOutputs());
+ // and add it as the single output
route.clearOutput();
route.addOutput(transacted);
}
Modified: camel/trunk/tests/camel-itest/pom.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/pom.xml?rev=896185&r1=896184&r2=896185&view=diff
==============================================================================
--- camel/trunk/tests/camel-itest/pom.xml (original)
+++ camel/trunk/tests/camel-itest/pom.xml Tue Jan 5 19:18:54 2010
@@ -126,6 +126,38 @@
<scope>test</scope>
</dependency>
+ <!-- some TX tests using iBatis -->
+ <dependency>
+ <groupId>hsqldb</groupId>
+ <artifactId>hsqldb</artifactId>
+ <version>1.8.0.10</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-ibatis</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <!-- ibatis need this stuff -->
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-pool</groupId>
+ <artifactId>commons-pool</artifactId>
+ <version>1.5.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.1</version>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTable.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTable.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTable.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTable.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,35 @@
+/**
+ * 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.itest.ibatis;
+
+import java.util.Collection;
+
+/**
+ * @version $Revision$
+ */
+public interface DummyTable extends Iterable<Integer> {
+
+ void create();
+
+ void add(int value);
+
+ void clear();
+
+ void drop();
+
+ Collection<Integer> values();
+}
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTable.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTableImpl.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTableImpl.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTableImpl.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTableImpl.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,54 @@
+/**
+ * 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.itest.ibatis;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
+
+/**
+ * @version $Revision$
+ */
+public class DummyTableImpl extends SqlMapClientDaoSupport implements DummyTable {
+
+ public void add(int value) {
+ getSqlMapClientTemplate().insert("table.add", value);
+ }
+
+ public void create() {
+ getSqlMapClientTemplate().update("table.create");
+ }
+
+ public void clear() {
+ getSqlMapClientTemplate().delete("table.clear");
+ }
+
+ public void drop() {
+ getSqlMapClientTemplate().update("table.drop");
+ }
+
+ public Iterator<Integer> iterator() {
+ return values().iterator();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Collection<Integer> values() {
+ return getSqlMapClientTemplate().queryForList("table.values");
+ }
+
+}
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTableImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/DummyTableImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/ExceptionRethrower.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/ExceptionRethrower.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/ExceptionRethrower.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/ExceptionRethrower.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,30 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.ExchangeException;
+
+/**
+ * @version $Revision$
+ */
+public class ExceptionRethrower {
+
+ public void rethrowCaughtException(@ExchangeException Exception exception) throws Exception {
+ throw exception;
+ }
+
+}
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/ExceptionRethrower.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/ExceptionRethrower.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/LoggingPipelineTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/LoggingPipelineTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/LoggingPipelineTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/LoggingPipelineTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,99 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+
+/**
+ * @version $Revision$
+ */
+public class LoggingPipelineTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @EndpointInject(uri = "mock:error")
+ private MockEndpoint error;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/LoggingPipelineTest.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ end.expectedMessageCount(1);
+ producer.sendBody(3);
+ }
+
+ @Test
+ public void pipelineAborts() {
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ error.expectedMessageCount(1);
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getClass());
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/LoggingPipelineTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/LoggingPipelineTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,99 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class PartiallyTransactedPipelineTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:middle")
+ private MockEndpoint middle;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ middle.expectedMessageCount(1);
+ end.expectedMessageCount(1);
+ producer.sendBody(3);
+ assertEquals(1, table.values().size());
+ assertEquals(3, (int) table.iterator().next());
+ }
+
+ @Test
+ public void pipelineAborts() {
+ middle.expectedMessageCount(1);
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getCause().getClass());
+ assertEquals(0, table.values().size());
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTagTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTagTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTagTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTagTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,103 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+
+/**
+ * @version $Revision$
+ */
+public class TransactedExceptionClauseAfterTransactedTagTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @EndpointInject(uri = "mock:error")
+ private MockEndpoint error;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ end.expectedMessageCount(1);
+ error.expectedMessageCount(0);
+ producer.sendBody(3);
+ assertEquals(1, table.values().size());
+ assertEquals(3, (int) table.iterator().next());
+ }
+
+ @Test
+ public void pipelineAborts() {
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ error.expectedMessageCount(1);
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getCause().getClass());
+ assertEquals(0, table.values().size());
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTagTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTagTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedFullExampleTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedFullExampleTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedFullExampleTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedFullExampleTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,131 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+
+/**
+ * @version $Revision$
+ */
+public class TransactedFullExampleTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:middle")
+ private MockEndpoint middle;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @EndpointInject(uri = "mock:error1")
+ private MockEndpoint error1;
+
+ @EndpointInject(uri = "mock:error2")
+ private MockEndpoint error2;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ middle.expectedMessageCount(1);
+ end.expectedMessageCount(1);
+ error1.expectedMessageCount(0);
+ error2.expectedMessageCount(0);
+ producer.sendBody(3);
+ assertEquals(1, table.values().size());
+ assertEquals(3, (int) table.iterator().next());
+ }
+
+ @Test
+ public void pipelineAbortsInMiddle() {
+ middle.expectedMessageCount(1);
+ middle.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ error1.expectedMessageCount(1);
+
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ @Test
+ public void pipelineAbortsAtEnd() {
+ middle.expectedMessageCount(1);
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ error2.expectedMessageCount(1);
+
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getCause().getClass());
+ assertEquals(0, table.values().size());
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedFullExampleTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedFullExampleTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,99 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class TransactedOnCompletionTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @EndpointInject(uri = "mock:after")
+ private MockEndpoint after;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ end.expectedMessageCount(1);
+ after.expectedMessageCount(1);
+ producer.sendBody(3);
+ assertEquals(1, table.values().size());
+ assertEquals(3, (int) table.iterator().next());
+ }
+
+ @Test
+ public void pipelineAborts() {
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ after.expectedMessageCount(1);
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getCause().getClass());
+ assertEquals(0, table.values().size());
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,99 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class TransactedOnExceptionTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @EndpointInject(uri = "mock:error")
+ private MockEndpoint error;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ end.expectedMessageCount(1);
+ error.expectedMessageCount(0);
+ producer.sendBody(3);
+ assertEquals(1, table.values().size());
+ assertEquals(3, (int) table.iterator().next());
+ }
+
+ @Test
+ public void pipelineAborts() {
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ error.expectedMessageCount(1);
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getCause().getClass());
+ assertEquals(0, table.values().size());
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedPipelineTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedPipelineTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedPipelineTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedPipelineTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,94 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * @version $Revision$
+ */
+public class TransactedPipelineTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/TransactedPipelineTest.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ end.expectedMessageCount(1);
+ producer.sendBody(3);
+ assertEquals(1, table.values().size());
+ assertEquals(3, (int) table.iterator().next());
+ }
+
+ @Test
+ public void pipelineAborts() {
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ try {
+ producer.sendBody(3);
+ assertFalse(true);
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getCause().getClass());
+ assertEquals(0, table.values().size());
+ }
+ }
+
+}
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedPipelineTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedPipelineTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedTryCatchTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedTryCatchTest.java?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedTryCatchTest.java (added)
+++ camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedTryCatchTest.java Tue Jan 5 19:18:54 2010
@@ -0,0 +1,111 @@
+/**
+ * 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.itest.ibatis;
+
+import org.apache.camel.CamelExecutionException;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelSpringTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+import org.springframework.test.annotation.DirtiesContext;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertFalse;
+
+/**
+ * @version $Revision$
+ */
+public class TransactedTryCatchTest extends CamelSpringTestSupport {
+
+ private class MyException extends Exception {
+ private static final long serialVersionUID = -221148660533176643L;
+
+ public MyException() {
+ super("my exception");
+ }
+ }
+
+ DummyTable table;
+
+ @EndpointInject(uri = "direct:start")
+ ProducerTemplate producer;
+
+ @EndpointInject(uri = "mock:end")
+ private MockEndpoint end;
+
+ @EndpointInject(uri = "mock:error")
+ private MockEndpoint error;
+
+ @Override
+ protected AbstractXmlApplicationContext createApplicationContext() {
+ return new ClassPathXmlApplicationContext("org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml");
+ }
+
+ @Before
+ public void createTable() {
+ table = context.getRegistry().lookup("table", DummyTable.class);
+ table.create();
+ }
+
+ @After
+ public void dropTable() {
+ table.drop();
+ }
+
+ @Test
+ public void pipelineCompletes() {
+ end.expectedMessageCount(1);
+ error.expectedMessageCount(0);
+ producer.sendBody(3);
+ assertEquals(1, table.values().size());
+ assertEquals(3, (int) table.iterator().next());
+ }
+
+ @Test
+ public void pipelineAbortsLate() {
+ end.expectedMessageCount(1);
+ end.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ throw new MyException();
+ }
+ });
+ error.expectedMessageCount(1);
+ error.whenAnyExchangeReceived(new Processor() {
+ public void process(Exchange exchange) throws Exception {
+ // System.out.println(exchange);
+ }
+ });
+ try {
+ producer.sendBody(3);
+ assertFalse(true); // Should throw an exception
+ } catch (CamelExecutionException e) {
+ assertEquals(MyException.class, e.getCause().getCause().getClass());
+ } catch (Exception e) {
+ assertFalse(true); // Should throw a CamelExecutionException
+ } finally {
+ assertEquals(0, table.values().size());
+ }
+ }
+
+}
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedTryCatchTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/java/org/apache/camel/itest/ibatis/TransactedTryCatchTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL MAP Config 2.0//EN"
+ "http://www.ibatis.com/dtd/sql-map-config-2.dtd">
+
+<sqlMapConfig>
+ <settings useStatementNamespaces="true" />
+ <sqlMap resource="table.xml" />
+</sqlMapConfig>
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/ibatis-config.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+
+ <onException>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="mock:error"/>
+ </onException>
+
+ <to uri="mock:end"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/LoggingPipelineTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start" />
+ <to uri="mock:middle" />
+ <transacted />
+ <to uri="ibatis:table.add?statementType=Insert" />
+ <to uri="mock:end" />
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/PartiallyTransactedPipelineTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+
+ <transacted/>
+
+ <onException>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="mock:error"/>
+ </onException>
+
+ <to uri="ibatis:table.add?statementType=Insert"/>
+ <to uri="mock:end"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedExceptionClauseAfterTransactedTag.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml"/>
+
+ <bean id="rethrowCaughtException" class="org.apache.camel.itest.ibatis.ExceptionRethrower"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <onException>
+ <exception>java.lang.Exception</exception>
+ <to uri="mock:error1"/>
+ </onException>
+
+ <to uri="mock:middle"/>
+ <to uri="direct:transacted"/>
+ </route>
+
+ <route>
+ <from uri="direct:transacted"/>
+ <transacted/>
+
+ <doTry>
+ <to uri="ibatis:table.add?statementType=Insert"/>
+ <to uri="mock:end"/>
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <to uri="mock:error2"/>
+ <bean ref="rethrowCaughtException"/>
+ </doCatch>
+ </doTry>
+
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedFullExampleTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml" />
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start" />
+ <onCompletion>
+ <to uri="mock:after" />
+ </onCompletion>
+ <transacted />
+ <to uri="ibatis:table.add?statementType=Insert" />
+ <to uri="mock:end" />
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnCompletionTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml" />
+
+ <camelContext trace="true" xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start" />
+
+ <onException>
+ <exception>java.lang.Exception</exception>
+ <handled><constant>false</constant></handled>
+ <to uri="mock:error" />
+ </onException>
+
+ <transacted />
+
+ <to uri="ibatis:table.add?statementType=Insert" />
+ <to uri="mock:end" />
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedOnExceptionTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <transacted/>
+ <to uri="ibatis:table.add?statementType=Insert"/>
+ <to uri="mock:end"/>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedPipelineTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+ http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
+ ">
+
+ <import resource="hsqldb-context.xml"/>
+
+ <bean id="rethrowCaughtException" class="org.apache.camel.itest.ibatis.ExceptionRethrower"/>
+
+ <camelContext xmlns="http://camel.apache.org/schema/spring">
+ <route>
+ <from uri="direct:start"/>
+ <transacted/>
+
+ <doTry>
+ <to uri="ibatis:table.add?statementType=Insert"/>
+ <to uri="mock:end"/>
+
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+
+ <to uri="mock:error"/>
+ <bean ref="rethrowCaughtException"/>
+ </doCatch>
+ </doTry>
+ </route>
+ </camelContext>
+
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/TransactedTryCatchTest.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
+
+ <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
+ <property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
+ <property name="url" value="jdbc:hsqldb:mem:."/>
+ <property name="username" value="sa"/>
+ <property name="password" value=""/>
+ </bean>
+
+ <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
+ <property name="configLocation" value="ibatis-config.xml"/>
+ <property name="useTransactionAwareDataSource" value="true"/>
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
+
+ <bean id="sqlMap" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
+ <property name="sqlMapClient" ref="sqlMapClient"/>
+ </bean>
+
+ <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
+ <property name="dataSource" ref="dataSource"/>
+ </bean>
+
+ <bean id="table" class="org.apache.camel.itest.ibatis.DummyTableImpl">
+ <property name="sqlMapClient" ref="sqlMapClient"/>
+ </bean>
+</beans>
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/org/apache/camel/itest/ibatis/hsqldb-context.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Added: camel/trunk/tests/camel-itest/src/test/resources/table.xml
URL: http://svn.apache.org/viewvc/camel/trunk/tests/camel-itest/src/test/resources/table.xml?rev=896185&view=auto
==============================================================================
--- camel/trunk/tests/camel-itest/src/test/resources/table.xml (added)
+++ camel/trunk/tests/camel-itest/src/test/resources/table.xml Tue Jan 5 19:18:54 2010
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL MAP 2.0//EN"
+ "http://www.ibatis.com/dtd/sql-map-2.dtd">
+
+<sqlMap namespace="table">
+ <update id="create">create table t (d int)</update>
+ <select id="values" resultClass="java.lang.Integer">select d from t</select>
+ <insert id="add" parameterClass="java.lang.Integer">insert into t(d) values(#value#)</insert>
+ <insert id="addOne">insert into t(d) values(1)</insert>
+ <update id="doNothing">update t set d=d</update>
+ <delete id="clear">delete from t</delete>
+ <update id="drop">drop table t</update>
+</sqlMap>
\ No newline at end of file
Propchange: camel/trunk/tests/camel-itest/src/test/resources/table.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: camel/trunk/tests/camel-itest/src/test/resources/table.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange: camel/trunk/tests/camel-itest/src/test/resources/table.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml