You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/10/30 16:45:51 UTC
[2/3] git commit: ACCUMULO-3278 Fix mis-matched arguments in
RetryFactory and add a test.
ACCUMULO-3278 Fix mis-matched arguments in RetryFactory and add a test.
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/443ae2d0
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/443ae2d0
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/443ae2d0
Branch: refs/heads/master
Commit: 443ae2d0264b2064f822acb02cf6c49855fe78e2
Parents: 1aa4784
Author: Josh Elser <el...@apache.org>
Authored: Thu Oct 30 11:17:40 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Thu Oct 30 11:18:36 2014 -0400
----------------------------------------------------------------------
.../apache/accumulo/fate/zookeeper/Retry.java | 20 ++++++++++
.../accumulo/fate/zookeeper/RetryFactory.java | 2 +-
.../fate/zookeeper/RetryFactoryTest.java | 39 ++++++++++++++++++++
3 files changed, 60 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/accumulo/blob/443ae2d0/fate/src/main/java/org/apache/accumulo/fate/zookeeper/Retry.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/Retry.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/Retry.java
index 7bfaba6..64e7811 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/Retry.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/Retry.java
@@ -46,6 +46,26 @@ public class Retry {
}
// Visible for testing
+ long getMaxRetries() {
+ return maxRetries;
+ }
+
+ // Visible for testing
+ long getCurrentWait() {
+ return currentWait;
+ }
+
+ // Visible for testing
+ long getWaitIncrement() {
+ return waitIncrement;
+ }
+
+ // Visible for testing
+ long getMaxWait() {
+ return maxWait;
+ }
+
+ // Visible for testing
void setMaxRetries(long maxRetries) {
this.maxRetries = maxRetries;
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/443ae2d0/fate/src/main/java/org/apache/accumulo/fate/zookeeper/RetryFactory.java
----------------------------------------------------------------------
diff --git a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/RetryFactory.java b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/RetryFactory.java
index ff96350..63a1241 100644
--- a/fate/src/main/java/org/apache/accumulo/fate/zookeeper/RetryFactory.java
+++ b/fate/src/main/java/org/apache/accumulo/fate/zookeeper/RetryFactory.java
@@ -33,6 +33,6 @@ public class RetryFactory {
}
public Retry create() {
- return new Retry(maxRetries, startWait, maxWait, waitIncrement);
+ return new Retry(maxRetries, startWait, waitIncrement, maxWait);
}
}
http://git-wip-us.apache.org/repos/asf/accumulo/blob/443ae2d0/fate/src/test/java/org/apache/accumulo/fate/zookeeper/RetryFactoryTest.java
----------------------------------------------------------------------
diff --git a/fate/src/test/java/org/apache/accumulo/fate/zookeeper/RetryFactoryTest.java b/fate/src/test/java/org/apache/accumulo/fate/zookeeper/RetryFactoryTest.java
new file mode 100644
index 0000000..cb3d608
--- /dev/null
+++ b/fate/src/test/java/org/apache/accumulo/fate/zookeeper/RetryFactoryTest.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.accumulo.fate.zookeeper;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ */
+public class RetryFactoryTest {
+
+ @Test
+ public void properArgumentsInRetry() {
+ long maxRetries = 10, startWait = 50l, maxWait = 5000l, waitIncrement = 500l;
+ RetryFactory factory = new RetryFactory(maxRetries, startWait, waitIncrement, maxWait);
+ Retry retry = factory.create();
+
+ Assert.assertEquals(maxRetries, retry.getMaxRetries());
+ Assert.assertEquals(startWait, retry.getCurrentWait());
+ Assert.assertEquals(maxWait, retry.getMaxWait());
+ Assert.assertEquals(waitIncrement, retry.getWaitIncrement());
+ }
+
+}