accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From md...@apache.org
Subject [5/6] git commit: Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT
Date Thu, 23 Jan 2014 14:23:31 GMT
Merge branch '1.4.5-SNAPSHOT' into 1.5.1-SNAPSHOT


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/fbed7afa
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/fbed7afa
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/fbed7afa

Branch: refs/heads/1.5.1-SNAPSHOT
Commit: fbed7afab4ff024872a04a3a4dae76558380ab02
Parents: c4cd3b1 de7d198
Author: Mike Drob <mdrob@cloudera.com>
Authored: Thu Jan 23 09:22:44 2014 -0500
Committer: Mike Drob <mdrob@cloudera.com>
Committed: Thu Jan 23 09:22:44 2014 -0500

----------------------------------------------------------------------
 .../test/java/org/apache/accumulo/fate/util/AddressUtilTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/fbed7afa/fate/src/test/java/org/apache/accumulo/fate/util/AddressUtilTest.java
----------------------------------------------------------------------
diff --cc fate/src/test/java/org/apache/accumulo/fate/util/AddressUtilTest.java
index aca4571,0000000..7d43381
mode 100644,000000..100644
--- a/fate/src/test/java/org/apache/accumulo/fate/util/AddressUtilTest.java
+++ b/fate/src/test/java/org/apache/accumulo/fate/util/AddressUtilTest.java
@@@ -1,95 -1,0 +1,95 @@@
 +/*
 + * 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.util;
 +
 +import java.security.Security;
 +
 +import junit.framework.TestCase;
 +
 +import org.apache.log4j.Logger;
 +
 +/**
 + * Test the AddressUtil class.
 + * 
 + */
 +public class AddressUtilTest extends TestCase {
 +
 +  private static final Logger log = Logger.getLogger(AddressUtilTest.class);
 +
 +  public void testGetNegativeTtl() {
 +    log.info("Checking that we can get the ttl on dns failures.");
 +    int expectedTtl = 20;
 +    boolean expectException = false;
-     /* TODO replace all of this with Powermock on the Security class */
++    /* TODO ACCUMULO-2242 replace all of this with Powermock on the Security class */
 +    try {
 +      Security.setProperty("networkaddress.cache.negative.ttl", Integer.toString(expectedTtl));
 +    } catch (SecurityException exception) {
 +      log.warn("We can't set the DNS cache period, so we're only testing fetching the system
value.");
 +      expectedTtl = 10;
 +    }
 +    try {
 +      expectedTtl = Integer.parseInt(Security.getProperty("networkaddress.cache.negative.ttl"));
 +    } catch (SecurityException exception) {
 +      log.debug("Security manager won't let us fetch the property, testing default path.");
 +      expectedTtl = 10;
 +    } catch (NumberFormatException exception) {
 +      log.debug("property isn't a number, testing default path.");
 +      expectedTtl = 10;
 +    }
 +    if (-1 == expectedTtl) {
 +      log.debug("property is set to 'forever', testing exception path");
 +      expectException = true;
 +    }
 +    if (0 > expectedTtl) {
 +      log.debug("property is a negative value other than 'forever', testing default path.");
 +      expectedTtl = 10;
 +    }
 +    try {
 +      if (expectException) {
 +        log.info("AddressUtil is (hopefully) going to spit out an error about DNS lookups.
you can ignore it.");
 +      }
 +      int result = AddressUtil.getAddressCacheNegativeTtl(null);
 +      if (expectException) {
 +        fail("The JVM Security settings cache DNS failures forever. In this case we expect
an exception but didn't get one.");
 +      }
 +      assertEquals("Didn't get the ttl we expected", expectedTtl, result);
 +    } catch (IllegalArgumentException exception) {
 +      if (!expectException) {
 +        log.error("Got an exception when we weren't expecting.", exception);
 +        fail("We only expect to throw an IllegalArgumentException when the JVM caches DNS
failures forever.");
 +      }
 +    }
 +  }
 +
 +  public void testGetNegativeTtlThrowsOnForever() {
 +    log.info("When DNS is cached forever, we should throw.");
-     /* TODO replace all of this with Powermock on the Security class */
++    /* TODO ACCUMULO-2242 replace all of this with Powermock on the Security class */
 +    try {
 +      Security.setProperty("networkaddress.cache.negative.ttl", "-1");
 +    } catch (SecurityException exception) {
 +      log.error("We can't set the DNS cache period, so this test is effectively ignored.");
 +      return;
 +    }
 +    try {
 +      log.info("AddressUtil is (hopefully) going to spit out an error about DNS lookups.
you can ignore it.");
 +      int result = AddressUtil.getAddressCacheNegativeTtl(null);
 +      fail("The JVM Security settings cache DNS failures forever, this should cause an exception.");
 +    } catch(IllegalArgumentException exception) {
 +      assertTrue(true);
 +    }
 +  }
 +}


Mime
View raw message