accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [1/3] git commit: ACCUMULO-3278 Fix mis-matched arguments in RetryFactory and add a test.
Date Thu, 30 Oct 2014 15:45:50 GMT
Repository: accumulo
Updated Branches:
  refs/heads/1.6 1aa4784a9 -> 443ae2d02
  refs/heads/master c662e0a15 -> 3d12c3285


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/1.6
Commit: 443ae2d0264b2064f822acb02cf6c49855fe78e2
Parents: 1aa4784
Author: Josh Elser <elserj@apache.org>
Authored: Thu Oct 30 11:17:40 2014 -0400
Committer: Josh Elser <elserj@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());
+  }
+
+}


Mime
View raw message