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 2020/01/31 05:24:38 UTC
[camel] 08/08: CAMEL-14354: camel-core optimize and fixed some
tests and added camel-tooling to distro kit
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
commit 70e3a0e30562e234a7b8473715653a21a5a8f5bf
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Jan 31 06:09:45 2020 +0100
CAMEL-14354: camel-core optimize and fixed some tests and added camel-tooling to distro kit
---
apache-camel/pom.xml | 8 ++++++++
apache-camel/src/main/descriptors/common-bin.xml | 2 ++
.../camel-osgi-activator/src/assembly/test-bundles.xml | 2 ++
.../apache/camel/dataformat/soap/SoapJaxbDataFormat.java | 14 +++++++-------
.../spring/integration/SpringIntegrationMessageTest.java | 3 ++-
.../main/java/org/apache/camel/support/DefaultMessage.java | 3 ++-
.../camel/example/transformer/OrderRouteSpringTest.java | 3 ++-
7 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/apache-camel/pom.xml b/apache-camel/pom.xml
index ea54e43..0e7a2e3 100644
--- a/apache-camel/pom.xml
+++ b/apache-camel/pom.xml
@@ -108,6 +108,14 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-main</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-tooling-model</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-tooling-util</artifactId>
+ </dependency>
<!-- NOTE: auto-generated list of components when building camel catalog -->
<!-- camel components: START -->
diff --git a/apache-camel/src/main/descriptors/common-bin.xml b/apache-camel/src/main/descriptors/common-bin.xml
index 40a0ed5..55c5667 100644
--- a/apache-camel/src/main/descriptors/common-bin.xml
+++ b/apache-camel/src/main/descriptors/common-bin.xml
@@ -40,6 +40,8 @@
<include>org.apache.camel:camel-cloud</include>
<include>org.apache.camel:camel-jaxp</include>
<include>org.apache.camel:camel-main</include>
+ <include>org.apache.camel:camel-tooling-model</include>
+ <include>org.apache.camel:camel-tooling-util</include>
<!-- NOTE: auto-generated list of components when building camel catalog -->
<!-- camel components: START -->
diff --git a/components/camel-osgi-activator/src/assembly/test-bundles.xml b/components/camel-osgi-activator/src/assembly/test-bundles.xml
index 917015b..905792c 100644
--- a/components/camel-osgi-activator/src/assembly/test-bundles.xml
+++ b/components/camel-osgi-activator/src/assembly/test-bundles.xml
@@ -38,6 +38,8 @@
<include>org.apache.camel:camel-support</include>
<include>org.apache.camel:camel-util</include>
<include>org.apache.camel:camel-util-json</include>
+ <include>org.apache.camel:camel-tooling-model</include>
+ <include>org.apache.camel:camel-tooling-util</include>
<include>org.apache.camel:spi-annotations</include>
<include>org.apache.camel:camel-timer</include>
<include>org.apache.camel:camel-log</include>
diff --git a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java
index 99670eb..4b68533 100644
--- a/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java
+++ b/components/camel-soap/src/main/java/org/apache/camel/dataformat/soap/SoapJaxbDataFormat.java
@@ -236,13 +236,13 @@ public class SoapJaxbDataFormat extends JaxbDataFormat {
}
public void setElementNameStrategy(Object nameStrategy) {
- if (nameStrategy == null) {
- this.elementNameStrategy = null;
- } else if (nameStrategy instanceof ElementNameStrategy) {
- this.elementNameStrategy = (ElementNameStrategy) nameStrategy;
- } else {
- throw new IllegalArgumentException("The argument for setElementNameStrategy should be subClass of "
- + ElementNameStrategy.class.getName());
+ if (nameStrategy != null) {
+ if (nameStrategy instanceof ElementNameStrategy) {
+ this.elementNameStrategy = (ElementNameStrategy) nameStrategy;
+ } else {
+ throw new IllegalArgumentException("The argument for setElementNameStrategy should be subClass of "
+ + ElementNameStrategy.class.getName());
+ }
}
}
diff --git a/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationMessageTest.java b/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationMessageTest.java
index 2237acf..c029852 100644
--- a/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationMessageTest.java
+++ b/components/camel-spring-integration/src/test/java/org/apache/camel/component/spring/integration/SpringIntegrationMessageTest.java
@@ -28,6 +28,7 @@ public class SpringIntegrationMessageTest {
@Test
public void testCopyFrom() {
CamelContext camelContext = new DefaultCamelContext();
+ camelContext.start();
org.springframework.messaging.Message testSpringMessage =
MessageBuilder.withPayload("Test")
@@ -37,7 +38,7 @@ public class SpringIntegrationMessageTest {
SpringIntegrationMessage original = new SpringIntegrationMessage(camelContext, testSpringMessage);
- SpringIntegrationMessage copy = new SpringIntegrationMessage((CamelContext) null, testSpringMessage);
+ SpringIntegrationMessage copy = new SpringIntegrationMessage(camelContext, testSpringMessage);
copy.copyFrom(original);
diff --git a/core/camel-support/src/main/java/org/apache/camel/support/DefaultMessage.java b/core/camel-support/src/main/java/org/apache/camel/support/DefaultMessage.java
index b6c729b..d8fadc5 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/DefaultMessage.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/DefaultMessage.java
@@ -16,6 +16,7 @@
*/
package org.apache.camel.support;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@@ -232,7 +233,7 @@ public class DefaultMessage extends MessageSupport {
}
} else {
// should not really happen but some tests rely on using camel context that is not started
- this.headers = headers;
+ this.headers = new HashMap<>(headers);
}
}
diff --git a/examples/camel-example-transformer-demo/src/test/java/org/apache/camel/example/transformer/OrderRouteSpringTest.java b/examples/camel-example-transformer-demo/src/test/java/org/apache/camel/example/transformer/OrderRouteSpringTest.java
index 584be2e..0029a99 100644
--- a/examples/camel-example-transformer-demo/src/test/java/org/apache/camel/example/transformer/OrderRouteSpringTest.java
+++ b/examples/camel-example-transformer-demo/src/test/java/org/apache/camel/example/transformer/OrderRouteSpringTest.java
@@ -105,7 +105,8 @@ public class OrderRouteSpringTest {
Exchange answer = xmlProducer.send("direct:xml", ex -> {
((DataTypeAware)ex.getIn()).setBody(order, new DataType("xml:XMLOrder"));
});
- XMLUnit.compareXML(expectedAnswer, answer.getOut().getBody(String.class));
+ String xml = answer.getMessage().getBody(String.class);
+ XMLUnit.compareXML(expectedAnswer, xml);
mockCsv.assertIsSatisfied();
}