camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/4] git commit: CAMEL-7544: Fixed XML DSL with customId attribute set cannot be read by Camel
Date Thu, 26 Jun 2014 14:08:12 GMT
CAMEL-7544: Fixed XML DSL with customId attribute set cannot be read by Camel


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/b69abf49
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/b69abf49
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/b69abf49

Branch: refs/heads/camel-2.13.x
Commit: b69abf49e8588e1f8ffea659f67ee50ac87182fc
Parents: 6818b5a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Jun 26 16:07:07 2014 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Jun 26 16:07:50 2014 +0200

----------------------------------------------------------------------
 .../test/blueprint/CustomIdIssuesTest.java      | 55 ++++++++++++++++++++
 .../camel/test/blueprint/CustomIdIssuesTest.xml | 47 +++++++++++++++++
 2 files changed, 102 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/b69abf49/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/CustomIdIssuesTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/CustomIdIssuesTest.java
b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/CustomIdIssuesTest.java
new file mode 100644
index 0000000..8e14c38
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/CustomIdIssuesTest.java
@@ -0,0 +1,55 @@
+/**
+ * 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.test.blueprint;
+
+import org.apache.camel.model.ChoiceDefinition;
+import org.apache.camel.model.FromDefinition;
+import org.apache.camel.model.LogDefinition;
+import org.apache.camel.model.RouteDefinition;
+import org.apache.camel.model.WhenDefinition;
+import org.junit.Test;
+
+public class CustomIdIssuesTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/CustomIdIssuesTest.xml";
+    }
+
+    @Test
+    public void testCustomId() {
+        RouteDefinition route = context.getRouteDefinition("myRoute");
+        assertNotNull(route);
+        assertTrue(route.hasCustomIdAssigned());
+
+        FromDefinition from = route.getInputs().get(0);
+        assertEquals("fromFile", from.getId());
+        assertTrue(from.hasCustomIdAssigned());
+
+        ChoiceDefinition choice = (ChoiceDefinition) route.getOutputs().get(0);
+        assertEquals("myChoice", choice.getId());
+        assertTrue(choice.hasCustomIdAssigned());
+
+        WhenDefinition when = choice.getWhenClauses().get(0);
+        assertTrue(when.hasCustomIdAssigned());
+        assertEquals("UK", when.getId());
+
+        LogDefinition log = (LogDefinition) choice.getOtherwise().getOutputs().get(0);
+        assertFalse(log.hasCustomIdAssigned());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b69abf49/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/CustomIdIssuesTest.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/CustomIdIssuesTest.xml
b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/CustomIdIssuesTest.xml
new file mode 100644
index 0000000..f940186
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/CustomIdIssuesTest.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one or more
+    contributor license agreements.  See the NOTICE file distributed with
+    this work for additional information regarding copyright ownership.
+    The ASF licenses this file to You under the Apache License, Version 2.0
+    (the "License"); you may not use this file except in compliance with
+    the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+           xsi:schemaLocation="
+             http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+    <route customId="true" id="myRoute">
+      <description>here is a sample which processes the input files
+        (leaving them in place - see the 'noop' flag)
+        then performs content based routing on the message using XPath</description>
+      <from uri="file:src/data?noop=true" customId="true" id="fromFile">
+        <description/>
+      </from>
+      <choice customId="true" id="myChoice">
+        <when customId="true" id="UK">
+          <xpath>/person/city = 'London'</xpath>
+          <log message="UK message" customId="true" id="ukLog"/>
+          <to uri="file:target/messages/uk" customId="true" id="ukOutput"/>
+        </when>
+        <otherwise>
+          <log message="Other message"/>
+          <to uri="file:target/messages/others"/>
+        </otherwise>
+      </choice>
+    </route>
+
+  </camelContext>
+
+</blueprint>


Mime
View raw message