Updated Branches: refs/heads/master 8f6821171 -> 132a272eb
ACCUMULO-1664 fix ReadWriteIT's access to monitor page Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/132a272e Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/132a272e Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/132a272e Branch: refs/heads/master Commit: 132a272eba9208b881b775851e63764f84c3f46a Parents: 8f68211 Author: Billie Rinaldi <billie.rina...@gmail.com> Authored: Fri Sep 13 16:17:10 2013 -0700 Committer: Billie Rinaldi <billie.rina...@gmail.com> Committed: Fri Sep 13 16:18:05 2013 -0700 ---------------------------------------------------------------------- .../apache/accumulo/test/functional/AbstractMacIT.java | 12 ++++++++++++ .../apache/accumulo/test/functional/ReadWriteIT.java | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/132a272e/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java b/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java index 6ea4452..f1a651d 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/AbstractMacIT.java @@ -19,13 +19,19 @@ package org.apache.accumulo.test.functional; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.Instance; +import org.apache.accumulo.core.client.ZooKeeperInstance; +import org.apache.accumulo.core.zookeeper.ZooUtil; +import org.apache.accumulo.fate.zookeeper.ZooReader; import org.apache.accumulo.minicluster.MiniAccumuloCluster; import org.apache.log4j.Logger; +import org.apache.zookeeper.KeeperException; import org.junit.rules.TemporaryFolder; public abstract class AbstractMacIT { @@ -55,6 +61,12 @@ public abstract class AbstractMacIT { return getCluster().getConnector("root", ROOT_PASSWORD); } + public String getMonitor() throws KeeperException, InterruptedException { + Instance instance = new ZooKeeperInstance(getCluster().getInstanceName(), getCluster().getZooKeepers()); + ZooReader zr = new ZooReader(getCluster().getZooKeepers(), 5000); + return new String(zr.getData(ZooUtil.getRoot(instance) + Constants.ZMONITOR, null)); + } + public String rootPath() { return getCluster().getConfig().getDir().getAbsolutePath(); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/132a272e/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java b/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java index 8cad540..856f0c7 100644 --- a/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java +++ b/test/src/test/java/org/apache/accumulo/test/functional/ReadWriteIT.java @@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import java.net.InetAddress; import java.net.URL; import java.util.Collections; import java.util.HashSet; @@ -38,7 +37,6 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Range; @@ -70,7 +68,7 @@ public class ReadWriteIT extends ConfigurableMacIT { Connector connector = getConnector(); ingest(connector, ROWS, COLS, 50, 0); verify(connector, ROWS, COLS, 50, 0); - URL url = new URL("http://" + InetAddress.getLocalHost().getHostName() + ":" + cluster.getConfig().getSiteConfig().get(Property.MONITOR_PORT.getKey())); + URL url = new URL("http://" + getMonitor()); log.debug("Fetching web page " + url); String result = FunctionalTestUtils.readAll(url.openStream()); assertTrue(result.length() > 100);