Permalink
Browse files

CAMEL-5838: Corrected the preexisting typo in awaitExistence setter m…

…ethod by ZooKeeperConfiguration (setAwaitExistance instead of setAwaitExistence), added a unit-test and as well did some tiny polishments.

git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@1415884 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 68b81ca commit 4e1bb9b2a87eb8edebf15a62a6b12a639effe733 @bvahdat bvahdat committed Nov 30, 2012
@@ -52,11 +52,6 @@
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
@@ -43,8 +43,7 @@ public ZooKeeperComponent(ZooKeeperConfiguration configuration) {
this.configuration = configuration;
}
- @SuppressWarnings("all")
- protected Endpoint createEndpoint(String uri, String remaining, Map parameters) throws Exception {
+ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
if (getCamelContext() == null) {
throw new CamelException("No Camel context has been provided to this zookeeper component");
}
@@ -131,7 +131,7 @@ public boolean shouldAwaitExistence() {
return awaitExistence;
}
- public void setAwaitExistance(boolean awaitExistence) {
+ public void setAwaitExistence(boolean awaitExistence) {
this.awaitExistence = awaitExistence;
}
@@ -151,7 +151,7 @@ public boolean getAwaitExistence() {
@ManagedAttribute
public void setAwaitExistence(boolean awaitExistence) {
- getConfiguration().setAwaitExistance(awaitExistence);
+ getConfiguration().setAwaitExistence(awaitExistence);
}
@ManagedOperation
@@ -0,0 +1,36 @@
+/**
+ * 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.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class ZookeeperEndpointTest extends CamelTestSupport {
+
+ @Test
+ public void testAwaitExistenceOptionOnEndpoint() {
+ ZooKeeperEndpoint endpoint = context.getEndpoint("zookeeper:someserver/zoo", ZooKeeperEndpoint.class);
+ assertTrue("The awaitExistance option defaults to true", endpoint.getAwaitExistence());
+
+ endpoint = context.getEndpoint("zookeeper:someserver/zoo?awaitExistence=true", ZooKeeperEndpoint.class);
+ assertTrue("The awaitExistance option should be true", endpoint.getAwaitExistence());
+
+ endpoint = context.getEndpoint("zookeeper:someserver/zoo?awaitExistence=false", ZooKeeperEndpoint.class);
+ assertFalse("The awaitExistance option should be false", endpoint.getAwaitExistence());
+ }
+
+}

0 comments on commit 4e1bb9b

Please sign in to comment.