Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 40125200B4B for ; Thu, 21 Jul 2016 08:55:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3EC2B160A6D; Thu, 21 Jul 2016 06:55:46 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5E939160A68 for ; Thu, 21 Jul 2016 08:55:45 +0200 (CEST) Received: (qmail 69226 invoked by uid 500); 21 Jul 2016 06:55:39 -0000 Mailing-List: contact commits-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@camel.apache.org Delivered-To: mailing list commits@camel.apache.org Received: (qmail 69087 invoked by uid 99); 21 Jul 2016 06:55:39 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Jul 2016 06:55:39 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4A8A8E1101; Thu, 21 Jul 2016 06:55:39 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ggrzybek@apache.org To: commits@camel.apache.org Date: Thu, 21 Jul 2016 06:55:41 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [3/4] camel git commit: CAMEL-10038: added unit test for BlueprintPropertiesParser fallbackToUnaugmentedProperty behavior archived-at: Thu, 21 Jul 2016 06:55:46 -0000 CAMEL-10038: added unit test for BlueprintPropertiesParser fallbackToUnaugmentedProperty behavior (cherry picked from commit da85e4c86fc7fdb6156b00aafbaac8c35a0168ca) Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/55ee517f Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/55ee517f Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/55ee517f Branch: refs/heads/master Commit: 55ee517f05515cf3bb257e67930db8be10c26c90 Parents: 8137499 Author: Matthew Zipay Authored: Wed Jul 20 11:54:27 2016 -0400 Committer: Grzegorz Grzybek Committed: Thu Jul 21 08:53:26 2016 +0200 ---------------------------------------------------------------------- ...lueprintAugmentedPropertiesFallbackTest.java | 50 ++++++++++++++++++++ .../test/resources/etc/augmented.fallback.cfg | 23 +++++++++ .../blueprint/augmented-properties-fallback.xml | 48 +++++++++++++++++++ 3 files changed, 121 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/55ee517f/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java new file mode 100644 index 0000000..fa12e13 --- /dev/null +++ b/components/camel-test-blueprint/src/test/java/org/apache/camel/test/blueprint/BlueprintAugmentedPropertiesFallbackTest.java @@ -0,0 +1,50 @@ +/** + * 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; + +/** + * A test showing that Blueprint XML property placeholders work correctly with + * augmented property names and fallback behavior. + */ +public class BlueprintAugmentedPropertiesFallbackTest extends CamelBlueprintTestSupport { + + @Override + protected String getBlueprintDescriptor() { + return "org/apache/camel/test/blueprint/augmented-properties-fallback.xml"; + } + + @Override + protected String[] loadConfigAdminConfigurationFile() { + return new String[] {"src/test/resources/etc/augmented.fallback.cfg", "augmented.fallback"}; + } + + @Test + public void testFallbackToUnaugmentedProperty() throws Exception { + /* + * mock:result only gets the expected body if BlueprintPropertiesParser + * correctly fell back from "TEST.destination" to "destination" + */ + getMockEndpoint("mock:result").expectedBodiesReceived("fallbackToUnaugmentedProperty is working"); + + template.sendBody("direct:start", null); + + assertMockEndpointsSatisfied(); + } + +} http://git-wip-us.apache.org/repos/asf/camel/blob/55ee517f/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg b/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg new file mode 100644 index 0000000..f6ada0a --- /dev/null +++ b/components/camel-test-blueprint/src/test/resources/etc/augmented.fallback.cfg @@ -0,0 +1,23 @@ +## ------------------------------------------------------------------------ +## 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. +## ------------------------------------------------------------------------ + +source = direct:not-from-here +TEST.source = direct:start + +# augmented TEST.destination should fall back to this +destination = mock:result + http://git-wip-us.apache.org/repos/asf/camel/blob/55ee517f/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml ---------------------------------------------------------------------- diff --git a/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml new file mode 100644 index 0000000..d26d6b9 --- /dev/null +++ b/components/camel-test-blueprint/src/test/resources/org/apache/camel/test/blueprint/augmented-properties-fallback.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + fallbackToUnaugmentedProperty is working + + + + + + +