Return-Path: X-Original-To: apmail-accumulo-commits-archive@www.apache.org Delivered-To: apmail-accumulo-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CB45D17632 for ; Thu, 30 Oct 2014 15:45:50 +0000 (UTC) Received: (qmail 12595 invoked by uid 500); 30 Oct 2014 15:45:50 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 12566 invoked by uid 500); 30 Oct 2014 15:45:50 -0000 Mailing-List: contact commits-help@accumulo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@accumulo.apache.org Delivered-To: mailing list commits@accumulo.apache.org Received: (qmail 12508 invoked by uid 99); 30 Oct 2014 15:45:50 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Oct 2014 15:45:50 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 24193980D95; Thu, 30 Oct 2014 15:45:50 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: elserj@apache.org To: commits@accumulo.apache.org Date: Thu, 30 Oct 2014 15:45:50 -0000 Message-Id: <5a5952720fae4a918ad12b7eb2705530@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/3] git commit: ACCUMULO-3278 Fix mis-matched arguments in RetryFactory and add a test. 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 Authored: Thu Oct 30 11:17:40 2014 -0400 Committer: Josh Elser 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()); + } + +}