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/07/23 10:09:07 UTC
[1/2] git commit: Fix for CAMEL-7606 Expose the component options for
Camel Zookeeper
Repository: camel
Updated Branches:
refs/heads/master f41a7e4d5 -> 3c3364d21
Fix for CAMEL-7606 Expose the component options for Camel Zookeeper
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/041e8e9e
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/041e8e9e
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/041e8e9e
Branch: refs/heads/master
Commit: 041e8e9e8d22941a548c0d7481af1285a93e0eb7
Parents: bbb972a
Author: Kevin Earls <ke...@kevinearls.com>
Authored: Tue Jul 22 16:30:06 2014 +0200
Committer: Kevin Earls <ke...@kevinearls.com>
Committed: Tue Jul 22 16:30:06 2014 +0200
----------------------------------------------------------------------
.../component/zookeeper/ZooKeeperComponent.java | 8 +--
.../zookeeper/ZooKeeperConfiguration.java | 12 +++++
.../component/zookeeper/ZooKeeperEndpoint.java | 4 ++
...ponentConfigurationAndDocumentationTest.java | 56 ++++++++++++++++++++
4 files changed, 77 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/041e8e9e/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperComponent.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperComponent.java b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperComponent.java
index c1f014e..8681f8f 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperComponent.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperComponent.java
@@ -23,23 +23,25 @@ import java.util.Map;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelException;
import org.apache.camel.Endpoint;
-import org.apache.camel.impl.DefaultComponent;
+import org.apache.camel.impl.UriEndpointComponent;
/**
* Component that creates {@link ZooKeeperEndpoint}s for interacting with a ZooKeeper cluster.
*/
-public class ZooKeeperComponent extends DefaultComponent {
+public class ZooKeeperComponent extends UriEndpointComponent {
private ZooKeeperConfiguration configuration;
public ZooKeeperComponent() {
+ super(ZooKeeperEndpoint.class);
}
public ZooKeeperComponent(CamelContext context) {
- super(context);
+ super(context, ZooKeeperEndpoint.class);
}
public ZooKeeperComponent(ZooKeeperConfiguration configuration) {
+ super(ZooKeeperEndpoint.class);
this.configuration = configuration;
}
http://git-wip-us.apache.org/repos/asf/camel/blob/041e8e9e/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
index e89d915..520456e 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperConfiguration.java
@@ -18,6 +18,8 @@ package org.apache.camel.component.zookeeper;
import java.util.ArrayList;
import java.util.List;
+import org.apache.camel.spi.UriParam;
+import org.apache.camel.spi.UriParams;
import org.apache.camel.RuntimeCamelException;
@@ -28,19 +30,29 @@ import org.apache.camel.RuntimeCamelException;
* {@link ZooKeeperComponent}. A copy of this component's configuration will be
* injected into any {@link ZooKeeperEndpoint}s the component creates.
*/
+@UriParams
public class ZooKeeperConfiguration implements Cloneable {
private transient boolean changed;
+ @UriParam
private int timeout = 5000;
+ @UriParam
private long backoff = 5000;
private List<String> servers;
+ @UriParam
private String path;
+ @UriParam
private boolean awaitExistence = true;
+ @UriParam
private boolean repeat;
+ @UriParam
private boolean listChildren;
+ @UriParam
private boolean shouldCreate;
+ @UriParam
private String createMode;
+ @UriParam
private boolean sendEmptyMessageOnDelete = true;
public void addZookeeperServer(String server) {
http://git-wip-us.apache.org/repos/asf/camel/blob/041e8e9e/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
index 8233dee..04eea3d 100644
--- a/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
+++ b/components/camel-zookeeper/src/main/java/org/apache/camel/component/zookeeper/ZooKeeperEndpoint.java
@@ -26,12 +26,16 @@ import org.apache.camel.api.management.ManagedAttribute;
import org.apache.camel.api.management.ManagedOperation;
import org.apache.camel.api.management.ManagedResource;
import org.apache.camel.impl.DefaultEndpoint;
+import org.apache.camel.spi.UriEndpoint;
+import org.apache.camel.spi.UriParam;
/**
* <code>ZooKeeperEndpoint</code>
*/
@ManagedResource(description = "ZooKeeper Endpoint")
+@UriEndpoint(scheme = "zookeeper", consumerClass = ZooKeeperConsumer.class)
public class ZooKeeperEndpoint extends DefaultEndpoint {
+ @UriParam
private ZooKeeperConfiguration configuration;
private ZooKeeperConnectionManager connectionManager;
http://git-wip-us.apache.org/repos/asf/camel/blob/041e8e9e/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperComponentConfigurationAndDocumentationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperComponentConfigurationAndDocumentationTest.java b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperComponentConfigurationAndDocumentationTest.java
new file mode 100644
index 0000000..c0cfe61
--- /dev/null
+++ b/components/camel-zookeeper/src/test/java/org/apache/camel/component/zookeeper/ZookeeperComponentConfigurationAndDocumentationTest.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.zookeeper;
+
+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 ZookeeperComponentConfigurationAndDocumentationTest extends CamelTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ @Test
+ public void testComponentConfiguration() throws Exception {
+ ZooKeeperComponent comp = context.getComponent("zookeeper", ZooKeeperComponent.class);
+ EndpointConfiguration conf = comp.createConfiguration("zookeeper://localhost:39913/somepath/somenode?create=true&createMode=PERSISTENT");
+
+ assertEquals("true", conf.getParameter("create"));
+ assertEquals("PERSISTENT", conf.getParameter("createMode"));
+
+ ComponentConfiguration compConf = comp.createComponentConfiguration();
+ String json = compConf.createParameterJsonSchema();
+ assertNotNull(json);
+
+ assertTrue(json.contains("\"createMode\": { \"type\": \"java.lang.String\" }"));
+ assertTrue(json.contains("\"backoff\": { \"type\": \"long\" }"));
+ }
+
+ @Test
+ public void testComponentDocumentation() throws Exception {
+ CamelContext context = new DefaultCamelContext();
+ String html = context.getComponentDocumentation("zookeeper");
+ assertNotNull("Should have found some auto-generated HTML if on Java 7", html);
+ }
+
+}
[2/2] git commit: Merge branch 'CAMEL-7606' of
https://github.com/kevinearls/camel
Posted by da...@apache.org.
Merge branch 'CAMEL-7606' of https://github.com/kevinearls/camel
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/3c3364d2
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/3c3364d2
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/3c3364d2
Branch: refs/heads/master
Commit: 3c3364d214a7fef92ad726cbc1e10f0453a8099b
Parents: f41a7e4 041e8e9
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Jul 23 10:08:53 2014 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed Jul 23 10:08:53 2014 +0200
----------------------------------------------------------------------
.../component/zookeeper/ZooKeeperComponent.java | 8 +--
.../zookeeper/ZooKeeperConfiguration.java | 12 +++++
.../component/zookeeper/ZooKeeperEndpoint.java | 4 ++
...ponentConfigurationAndDocumentationTest.java | 56 ++++++++++++++++++++
4 files changed, 77 insertions(+), 3 deletions(-)
----------------------------------------------------------------------