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 2014/06/24 16:18:22 UTC

git commit: Fix for CAMEL-7523 Expose the component options for Camel CXF

Repository: camel
Updated Branches:
  refs/heads/master 7a0afad25 -> ebbce3afc


Fix for CAMEL-7523 Expose the component options for Camel CXF


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

Branch: refs/heads/master
Commit: ebbce3afcc4e8b57d0cc1ebb16e51f1faf69f9c9
Parents: 7a0afad
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Tue Jun 24 16:13:09 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Tue Jun 24 16:13:09 2014 +0200

----------------------------------------------------------------------
 .../apache/camel/component/cxf/CxfEndpoint.java | 29 ++++++++++
 ...ponentConfigurationAndDocumentationTest.java | 56 ++++++++++++++++++++
 2 files changed, 85 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ebbce3af/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
index 91dc76c..af9349b 100644
--- a/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
+++ b/components/camel-cxf/src/main/java/org/apache/camel/component/cxf/CxfEndpoint.java
@@ -38,6 +38,8 @@ import javax.xml.ws.Provider;
 import javax.xml.ws.WebServiceProvider;
 import javax.xml.ws.handler.Handler;
 
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
@@ -108,39 +110,61 @@ import org.slf4j.LoggerFactory;
  * {@link CxfBinding}, and {@link HeaderFilterStrategy}.  The default DataFormat
  * mode is {@link DataFormat#POJO}.
  */
+@UriEndpoint(scheme = "cxf", consumerClass = CxfConsumer.class)
 public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategyAware, Service, Cloneable {
 
     private static final Logger LOG = LoggerFactory.getLogger(CxfEndpoint.class);
 
     protected Bus bus;
+    @UriParam
     private boolean createBus;
 
+    @UriParam
     private String wsdlURL;
     private Class<?> serviceClass;
     private QName portName;
     private QName serviceName;
+    @UriParam
     private String portNameString;
+    @UriParam
     private String serviceNameString;
+    @UriParam
     private String defaultOperationName;
+    @UriParam
     private String defaultOperationNamespace;
     // This is for invoking the CXFClient with wrapped parameters of unwrapped parameters
+    @UriParam
     private boolean isWrapped;
     // This is for marshal or unmarshal message with the document-literal wrapped or unwrapped style
+    @UriParam
     private Boolean wrappedStyle;
+    @UriParam
     private Boolean allowStreaming;
+    @UriParam
     private DataFormat dataFormat = DataFormat.POJO;
+    @UriParam
     private String publishedEndpointUrl;
+    @UriParam
     private boolean inOut = true;
     private CxfBinding cxfBinding;
     private HeaderFilterStrategy headerFilterStrategy;
+    @UriParam
     private AtomicBoolean getBusHasBeenCalled = new AtomicBoolean(false);
+    @UriParam
     private boolean isSetDefaultBus;
+    @UriParam
     private boolean loggingFeatureEnabled;
+    @UriParam
     private int loggingSizeLimit;
+    @UriParam
     private String address;
+    @UriParam
     private boolean mtomEnabled;
+    @UriParam
     private boolean skipPayloadMessagePartCheck;
+    @UriParam
     private boolean skipFaultLogging;
+    @UriParam
     private boolean mergeProtocolHeaders;
     private Map<String, Object> properties;
     private List<Interceptor<? extends Message>> in = new ModCountCopyOnWriteArrayList<Interceptor<? extends Message>>();
@@ -152,7 +176,9 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
     @SuppressWarnings("rawtypes")
     private List<Handler> handlers;
     private List<String> schemaLocations;
+    @UriParam
     private String transportId;
+    @UriParam
     private String bindingId;
     
     private BindingConfiguration bindingConfig;
@@ -161,10 +187,13 @@ public class CxfEndpoint extends DefaultEndpoint implements HeaderFilterStrategy
     private CxfEndpointConfigurer configurer;
     
     // The continuation timeout value for CXF continuation to use
+    @UriParam
     private long continuationTimeout = 30000;
     
     // basic authentication option for the CXF client
+    @UriParam
     private String username;
+    @UriParam
     private String password;
 
     public CxfEndpoint() {

http://git-wip-us.apache.org/repos/asf/camel/blob/ebbce3af/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfComponentConfigurationAndDocumentationTest.java b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..e74c63f
--- /dev/null
+++ b/components/camel-cxf/src/test/java/org/apache/camel/component/cxf/CxfComponentConfigurationAndDocumentationTest.java
@@ -0,0 +1,56 @@
+/**
+ * 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;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.EndpointConfiguration;
+import org.apache.camel.impl.DefaultCamelContext;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class CxfComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testComponentConfiguration() throws Exception {
+        CxfComponent comp = context.getComponent("cxf", CxfComponent.class);
+        EndpointConfiguration conf = comp.createConfiguration("cxf:bean:cxfEndpoint?wsdlURL=wsdl/hello_world.wsdl&dataFormat=PAYLOAD");
+
+        assertEquals("PAYLOAD", conf.getParameter("dataFormat"));
+        assertEquals("wsdl/hello_world.wsdl", conf.getParameter("wsdlURL"));
+
+        ComponentConfiguration compConf = comp.createComponentConfiguration();
+        String json = compConf.createParameterJsonSchema();
+        assertNotNull(json);
+
+        assertTrue(json.contains("\"serviceNameString\": { \"type\": \"java.lang.String\" }"));
+        assertTrue(json.contains("\"isWrapped\": { \"type\": \"boolean\" }"));
+    }
+
+    @Test
+    public void testComponentDocumentation() throws Exception {
+        CamelContext context = new DefaultCamelContext();
+        String html = context.getComponentDocumentation("cxf");
+        assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+    }
+
+}