Updated Branches: refs/heads/master 4660e6fa9 -> 107e3a4ed
added unit test for an issue on the user mailing list Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/0abd8fb3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/0abd8fb3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/0abd8fb3 Branch: refs/heads/master Commit: 0abd8fb34b3f77ecdb9fb2701381dae033217c69 Parents: d5183ff Author: cmueller <cmuel...@apache.org> Authored: Tue Jun 11 17:00:39 2013 +0200 Committer: cmueller <cmuel...@apache.org> Committed: Fri Jun 14 17:56:16 2013 +0200 ---------------------------------------------------------------------- .../processor/RemoveHeadersExcludeTest.java | 48 ++++++++++++++++++++ .../apache/camel/processor/camel-context.xml | 33 ++++++++++++++ 2 files changed, 81 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/0abd8fb3/components/camel-spring/src/test/java/org/apache/camel/processor/RemoveHeadersExcludeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/java/org/apache/camel/processor/RemoveHeadersExcludeTest.java b/components/camel-spring/src/test/java/org/apache/camel/processor/RemoveHeadersExcludeTest.java new file mode 100644 index 0000000..e5d1670 --- /dev/null +++ b/components/camel-spring/src/test/java/org/apache/camel/processor/RemoveHeadersExcludeTest.java @@ -0,0 +1,48 @@ +/** + * 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.processor; + +import java.util.HashMap; +import java.util.Map; + +import org.apache.camel.component.mock.MockEndpoint; +import org.apache.camel.spring.SpringTestSupport; +import org.springframework.context.support.AbstractXmlApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class RemoveHeadersExcludeTest extends SpringTestSupport { + + protected AbstractXmlApplicationContext createApplicationContext() { + return new ClassPathXmlApplicationContext("org/apache/camel/processor/camel-context.xml"); + } + + public void testRemoveHeadersWithExcludePatterns() throws Exception { + MockEndpoint mockEndpoint = getMockEndpoint("mock:result"); + mockEndpoint.expectedMessageCount(1); + mockEndpoint.expectedHeaderReceived("header1", "value1"); + mockEndpoint.expectedHeaderReceived("header3", "value3"); + + Map<String, Object> headers = new HashMap<String, Object>(); + headers.put("header1", "value1"); + headers.put("header2", "value2"); + headers.put("header3", "value3"); + + template.sendBodyAndHeaders("direct:start", null, headers); + + assertMockEndpointsSatisfied(); + } +} http://git-wip-us.apache.org/repos/asf/camel/blob/0abd8fb3/components/camel-spring/src/test/resources/org/apache/camel/processor/camel-context.xml ---------------------------------------------------------------------- diff --git a/components/camel-spring/src/test/resources/org/apache/camel/processor/camel-context.xml b/components/camel-spring/src/test/resources/org/apache/camel/processor/camel-context.xml new file mode 100644 index 0000000..fcbe5a4 --- /dev/null +++ b/components/camel-spring/src/test/resources/org/apache/camel/processor/camel-context.xml @@ -0,0 +1,33 @@ +<?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. +--> +<beans xmlns="http://www.springframework.org/schema/beans" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:context="http://www.springframework.org/schema/context" + xsi:schemaLocation=" + http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd + http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd + http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> + + <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> + <route> + <from uri="direct:start"/> + <removeHeaders pattern="*" excludePattern="header1|header3" /> + <to uri="mock:result"/> + </route> + </camelContext> +</beans> \ No newline at end of file