This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push: new 8c3157f CAMEL-14624: Fixed transacted in JAXB 8c3157f is described below commit 8c3157f69fbe4075e7c7cc741b5694a75bbb4998 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Mon Mar 2 10:07:04 2020 +0100 CAMEL-14624: Fixed transacted in JAXB --- .../apache/camel/spring/issues/Camel14624Test.java | 79 ++++++++++++++++++++++ .../apache/camel/model/TransactedDefinition.java | 5 ++ 2 files changed, 84 insertions(+) diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/issues/Camel14624Test.java b/components/camel-spring/src/test/java/org/apache/camel/spring/issues/Camel14624Test.java new file mode 100644 index 0000000..f51e070 --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/spring/issues/Camel14624Test.java @@ -0,0 +1,79 @@ +/* + * 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.spring.issues; + +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.spi.Registry; +import org.apache.camel.spi.TransactedPolicy; +import org.apache.camel.spring.spi.SpringTransactionPolicy; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.transaction.TransactionDefinition; +import org.springframework.transaction.TransactionException; +import org.springframework.transaction.TransactionStatus; + +public class Camel14624Test extends CamelTestSupport { + + @Override + protected void bindToRegistry(Registry registry) throws Exception { + TransactedPolicy required = new SpringTransactionPolicy(new MockTransactionManager()); + registry.bind("required", required); + } + + @Override + protected RouteBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:test") + .transacted("required") + .to("mock:result"); + } + }; + } + + @Test + public void testRoundtrip() throws Exception { + getMockEndpoint("mock:result").expectedMessageCount(1); + + template.sendBody("direct:test", "Hello World"); + + assertMockEndpointsSatisfied(); + } + + @Override + public boolean isDumpRouteCoverage() { + return true; + } + + class MockTransactionManager implements PlatformTransactionManager { + + @Override + public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException { + return null; + } + + @Override + public void commit(TransactionStatus status) throws TransactionException { + } + + @Override + public void rollback(TransactionStatus status) throws TransactionException { + } + } +} \ No newline at end of file diff --git a/core/camel-core-engine/src/main/java/org/apache/camel/model/TransactedDefinition.java b/core/camel-core-engine/src/main/java/org/apache/camel/model/TransactedDefinition.java index ba7fcdf..f98634e 100644 --- a/core/camel-core-engine/src/main/java/org/apache/camel/model/TransactedDefinition.java +++ b/core/camel-core-engine/src/main/java/org/apache/camel/model/TransactedDefinition.java @@ -57,6 +57,11 @@ public class TransactedDefinition extends OutputDefinition<TransactedDefinition> this.policy = policy; } + @Override + public List<ProcessorDefinition<?>> getOutputs() { + return outputs; + } + @XmlElementRef @Override public void setOutputs(List<ProcessorDefinition<?>> outputs) {