camel-cxf - Expose binding style as enum. Add missing options in component docs. Fixed bad style uri naming
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/4ce4955a Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/4ce4955a Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/4ce4955a Branch: refs/heads/camel-2.16.x Commit: 4ce4955a989c94b4cdf1b3a63fd626584e491112 Parents: 15856d2 Author: Claus Ibsen <davscl...@apache.org> Authored: Mon Jan 4 18:19:29 2016 +0100 Committer: Claus Ibsen <davscl...@apache.org> Committed: Mon Jan 4 18:37:46 2016 +0100 ---------------------------------------------------------------------- .../camel/component/cxf/jaxrs/BindingStyle.java | 39 ++++++++++++++++++++ .../component/cxf/jaxrs/CxfRsEndpoint.java | 21 ----------- .../cxf/CxfConsumerPayloadFaultTest.java | 2 +- ...sumerNamespaceOnEnvelopeStreamCacheTest.java | 2 +- ...fPayloadConsumerNamespaceOnEnvelopeTest.java | 2 +- ...ducerNamespaceOnEnvelopeStreamCacheTest.java | 2 +- ...fPayloadProducerNamespaceOnEnvelopeTest.java | 2 +- .../CxfRsBindingConfigurationSelectionTest.java | 5 --- .../cxf/wssecurity/camel/camel-context.xml | 4 +- 9 files changed, 46 insertions(+), 33 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/BindingStyle.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/BindingStyle.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/BindingStyle.java new file mode 100644 index 0000000..fb34aab --- /dev/null +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/BindingStyle.java @@ -0,0 +1,39 @@ +/** + * 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.component.cxf.jaxrs; + +public enum BindingStyle { + + /** + * <i>Only available for consumers.</i> + * This binding style processes request parameters, multiparts, etc. and maps them to IN headers, IN attachments and to the message body. + * It aims to eliminate low-level processing of {@link org.apache.cxf.message.MessageContentsList}. + * It also also adds more flexibility and simplicity to the response mapping. + */ + SimpleConsumer, + + /** + * This is the traditional binding style, which simply dumps the {@link org.apache.cxf.message.MessageContentsList} coming in from the CXF stack + * onto the IN message body. The user is then responsible for processing it according to the contract defined by the JAX-RS method signature. + */ + Default, + + /** + * A custom binding set by the user. + */ + Custom +} http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java index c3251fa..19ae089 100644 --- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java +++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/jaxrs/CxfRsEndpoint.java @@ -59,27 +59,6 @@ import org.slf4j.LoggerFactory; @UriEndpoint(scheme = "cxfrs", title = "CXF-RS", syntax = "cxfrs:beanId:address", consumerClass = CxfRsConsumer.class, label = "rest") public class CxfRsEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, Service { - public enum BindingStyle { - /** - * <i>Only available for consumers.</i> - * This binding style processes request parameters, multiparts, etc. and maps them to IN headers, IN attachments and to the message body. - * It aims to eliminate low-level processing of {@link org.apache.cxf.message.MessageContentsList}. - * It also also adds more flexibility and simplicity to the response mapping. - */ - SimpleConsumer, - - /** - * This is the traditional binding style, which simply dumps the {@link org.apache.cxf.message.MessageContentsList} coming in from the CXF stack - * onto the IN message body. The user is then responsible for processing it according to the contract defined by the JAX-RS method signature. - */ - Default, - - /** - * A custom binding set by the user. - */ - Custom - } - private static final Logger LOG = LoggerFactory.getLogger(CxfRsEndpoint.class); @UriPath http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultTest.java index 5925abe..96ebff6 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfConsumerPayloadFaultTest.java @@ -63,7 +63,7 @@ public class CxfConsumerPayloadFaultTest extends CamelTestSupport { protected final String serviceAddress = "http://localhost:" + CXFTestSupport.getPort1() + "/" + getClass().getSimpleName() + "/PersonService"; protected final String fromURI = "cxf://" + serviceAddress + "?" - + PORT_NAME_PROP + "&" + SERVICE_NAME_PROP + "&" + WSDL_URL_PROP + "&dataFormat=" + DataFormat.PAYLOAD; + + PORT_NAME_PROP + "&" + SERVICE_NAME_PROP + "&" + WSDL_URL_PROP + "&dataFormat=payload"; @Override public boolean isCreateCamelContextPerClass() { http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeStreamCacheTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeStreamCacheTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeStreamCacheTest.java index 5a805b9..bf30f07 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeStreamCacheTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeStreamCacheTest.java @@ -32,7 +32,7 @@ public class CxfPayloadConsumerNamespaceOnEnvelopeStreamCacheTest extends CxfPay // Convert to String to make testing the result easier .convertBodyTo(String.class); // The consumer is running in payload mode - from("cxf:bean:serviceEndpoint?DataFormat=PAYLOAD") + from("cxf:bean:serviceEndpoint?dataFormat=PAYLOAD") // Use stream caching to trigger the issue .streamCaching() // Parse to DOM to make sure it's still valid XML http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java index 65e2cf0..1f20c3e 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadConsumerNamespaceOnEnvelopeTest.java @@ -85,7 +85,7 @@ public class CxfPayloadConsumerNamespaceOnEnvelopeTest extends CamelTestSupport // Convert to String to make testing the result easier .convertBodyTo(String.class); // The consumer is running in payload mode - from("cxf:bean:serviceEndpoint?DataFormat=PAYLOAD") + from("cxf:bean:serviceEndpoint?dataFormat=PAYLOAD") // Convert the CxfPayload to a String to trigger the issue .convertBodyTo(String.class) // Parse to DOM to make sure it's still valid XML http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeStreamCacheTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeStreamCacheTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeStreamCacheTest.java index dc06375..3a77b14 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeStreamCacheTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeStreamCacheTest.java @@ -37,7 +37,7 @@ public class CxfPayloadProducerNamespaceOnEnvelopeStreamCacheTest extends CxfPay // easier .convertBodyTo(String.class); // This route just returns the test message - from("cxf:bean:serviceEndpoint?DataFormat=MESSAGE").setBody().constant(RESPONSE_MESSAGE); + from("cxf:bean:serviceEndpoint?dataFormat=MESSAGE").setBody().constant(RESPONSE_MESSAGE); } }; } http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java index 0dedbf8..dcf78b3 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfPayloadProducerNamespaceOnEnvelopeTest.java @@ -90,7 +90,7 @@ public class CxfPayloadProducerNamespaceOnEnvelopeTest extends CamelTestSupport // easier .convertBodyTo(String.class); // This route just returns the test message - from("cxf:bean:serviceEndpoint?DataFormat=MESSAGE").setBody().constant(RESPONSE_MESSAGE); + from("cxf:bean:serviceEndpoint?dataFormat=MESSAGE").setBody().constant(RESPONSE_MESSAGE); } }; } http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java index e5d94af..48054e3 100644 --- a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java +++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/jaxrs/CxfRsBindingConfigurationSelectionTest.java @@ -25,7 +25,6 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.cxf.CXFTestSupport; -import org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.BindingStyle; import org.apache.camel.impl.JndiRegistry; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; @@ -101,25 +100,21 @@ public class CxfRsBindingConfigurationSelectionTest extends CamelTestSupport { @Override public Object bindResponseToCamelBody(Object response, Exchange camelExchange) throws Exception { - // TODO Auto-generated method stub return null; } @Override public Map<String, Object> bindResponseHeadersToCamelHeaders(Object response, Exchange camelExchange) throws Exception { - // TODO Auto-generated method stub return null; } @Override public Object bindCamelMessageBodyToRequestBody(Message camelMessage, Exchange camelExchange) throws Exception { - // TODO Auto-generated method stub return null; } @Override public MultivaluedMap<String, String> bindCamelHeadersToRequestHeaders(Map<String, Object> camelHeaders, Exchange camelExchange) throws Exception { - // TODO Auto-generated method stub return null; } } http://git-wip-us.apache.org/repos/asf/camel/blob/4ce4955a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wssecurity/camel/camel-context.xml ---------------------------------------------------------------------- diff --git a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wssecurity/camel/camel-context.xml b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wssecurity/camel/camel-context.xml index bfe6640..347481d 100644 --- a/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wssecurity/camel/camel-context.xml +++ b/components/camel-cxf/src/test/resources/org/apache/camel/component/cxf/wssecurity/camel/camel-context.xml @@ -117,11 +117,11 @@ </route> <route errorHandlerRef="noErrorHandler"> <from uri="cxf:bean:encryptionRoute"/> - <to uri="cxf:bean:encryptionService?DefaultOperationName=greetMe"/> + <to uri="cxf:bean:encryptionService?defaultOperationName=greetMe"/> </route> <route errorHandlerRef="noErrorHandler"> <from uri="cxf:bean:securityPolicyRoute"/> - <to uri="cxf:bean:securityPolicyService?DefaultOperationName=greetMe"/> + <to uri="cxf:bean:securityPolicyService?defaultOperationName=greetMe"/> </route> </camelContext>