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 2016/02/24 08:09:27 UTC

[2/3] camel git commit: CAMEL-9636 - camel-test-blueprint - support for empty properties

CAMEL-9636 - camel-test-blueprint - support for empty properties


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

Branch: refs/heads/camel-2.16.x
Commit: 35c494e516dd5f822033f77c710963bca991e1ec
Parents: 3714616
Author: Paolo Antinori <pa...@redhat.com>
Authored: Tue Feb 23 17:50:45 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Feb 24 07:36:36 2016 +0100

----------------------------------------------------------------------
 .../blueprint/CamelBlueprintTestSupport.java    |  6 ++-
 ...minNoDefaultValuesBlueprintCreationTest.java | 54 ++++++++++++++++++++
 .../configadmin-endpoint-no-defaults.xml        | 44 ++++++++++++++++
 3 files changed, 102 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/35c494e5/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
index 1340218..35f55f8 100644
--- a/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
+++ b/components/camel-test-blueprint/src/main/java/org/apache/camel/test/blueprint/CamelBlueprintTestSupport.java
@@ -154,8 +154,10 @@ public abstract class CamelBlueprintTestSupport extends CamelTestSupport {
         // to the same state of BP container
         Set<Long> bpEvents = new HashSet<>();
 
-        CamelBlueprintHelper.waitForBlueprintContainer(bpEvents, answer, symbolicName, BlueprintEvent.CREATED, null);
-
+        if(!expectReload){
+            CamelBlueprintHelper.waitForBlueprintContainer(bpEvents, answer, symbolicName, BlueprintEvent.CREATED, null);
+        }
+        
         // must reuse props as we can do both load from .cfg file and override afterwards
         final Dictionary props = new Properties();
 

http://git-wip-us.apache.org/repos/asf/camel/blob/35c494e5/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java
new file mode 100644
index 0000000..f19342b
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/ConfigAdminNoDefaultValuesBlueprintCreationTest.java
@@ -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.test.blueprint;
+
+import org.junit.Test;
+import java.util.Dictionary;
+
+/**
+ *
+ */
+public class ConfigAdminNoDefaultValuesBlueprintCreationTest extends CamelBlueprintTestSupport {
+
+    @Override
+    protected boolean expectBlueprintContainerReloadOnConfigAdminUpdate(){
+        return true;
+    }
+
+    @Override
+    protected String getBlueprintDescriptor() {
+        return "org/apache/camel/test/blueprint/configadmin-endpoint-no-defaults.xml";
+    }
+
+    @Override
+    protected String useOverridePropertiesWithConfigAdmin(Dictionary props)
+            throws Exception {
+        props.put("greeting", "Bye");
+        props.put("destination", "mock:result");
+        return "my-placeholders";
+    }
+
+    @Test
+    public void testConfigAdmin() throws Exception {
+        getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+
+        template.sendBody("direct:start", "World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/35c494e5/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-endpoint-no-defaults.xml
----------------------------------------------------------------------
diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-endpoint-no-defaults.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-endpoint-no-defaults.xml
new file mode 100644
index 0000000..7a1b444
--- /dev/null
+++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/configadmin-endpoint-no-defaults.xml
@@ -0,0 +1,44 @@
+<?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.1.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 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
+
+  <!-- blueprint property placeholders -->
+  <cm:property-placeholder persistent-id="my-placeholders" update-strategy="reload">
+  </cm:property-placeholder>
+
+  <camelContext id="myCamel" xmlns="http://camel.apache.org/schema/blueprint">
+
+    <!-- need to use {{ }} with blueprint -->
+    <endpoint id="foo" uri="{{destination}}"/>
+
+    <route>
+      <from uri="direct:start"/>
+      <transform>
+        <simple>{{greeting}} ${body}</simple>
+      </transform>
+      <to uri="ref:foo"/>
+    </route>
+
+  </camelContext>
+
+</blueprint>