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 2018/03/05 12:07:11 UTC
[camel] 02/02: CAMEL-12291: Added unit test
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 c1cbc5847a8913236a2916eb79c94bd4d646467e
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Mon Mar 5 12:57:22 2018 +0100
CAMEL-12291: Added unit test
---
.../BlueprintComponentPropertyPlaceholderTest.java | 46 +++++++++++++++++++++
.../BlueprintComponentPropertyPlaceholderTest.xml | 47 ++++++++++++++++++++++
2 files changed, 93 insertions(+)
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintComponentPropertyPlaceholderTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintComponentPropertyPlaceholderTest.java
new file mode 100644
index 0000000..a690a3e
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintComponentPropertyPlaceholderTest.java
@@ -0,0 +1,46 @@
+/**
+ * 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.component.seda.SedaComponent;
+import org.junit.Test;
+
+public class BlueprintComponentPropertyPlaceholderTest extends CamelBlueprintTestSupport {
+
+ @Override
+ protected String getBlueprintDescriptor() {
+ return "org/apache/camel/test/blueprint/BlueprintComponentPropertyPlaceholderTest.xml";
+ }
+
+ @Test
+ public void testComponentPropertyPlaceholder() throws Exception {
+ SedaComponent myseda = (SedaComponent) context.getComponent("myseda", false);
+ assertNotNull(myseda);
+ assertEquals(2, myseda.getQueueSize());
+
+ // test that the custom component works
+
+ int before = myseda.getQueueReference("myseda://foo").getQueue().size();
+ assertEquals(0, before);
+
+ template.sendBody("direct:start", "Hello World");
+
+ int after = myseda.getQueueReference("myseda://foo").getQueue().size();
+ assertEquals(1, after);
+ }
+
+}
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/BlueprintComponentPropertyPlaceholderTest.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/BlueprintComponentPropertyPlaceholderTest.xml
new file mode 100644
index 0000000..fef5849
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/BlueprintComponentPropertyPlaceholderTest.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"
+ xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
+ xsi:schemaLocation="
+ http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0 http://aries.apache.org/schemas/blueprint-cm/blueprint-cm-1.0.0.xsd
+ http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+ <!-- blueprint property placeholders -->
+ <cm:property-placeholder persistent-id="my-placeholders">
+ <cm:default-properties>
+ <cm:property name="mySize" value="2"/>
+ </cm:default-properties>
+ </cm:property-placeholder>
+
+ <bean id="myseda" class="org.apache.camel.component.seda.SedaComponent">
+ <property name="queueSize" value="${mySize}"/>
+ </bean>
+
+ <camelContext xmlns="http://camel.apache.org/schema/blueprint">
+
+ <route>
+ <from uri="direct:start"/>
+ <to uri="myseda:foo"/>
+ </route>
+
+ </camelContext>
+
+</blueprint>
--
To stop receiving notification emails like this one, please contact
davsclaus@apache.org.