Repository: accumulo Updated Branches: refs/heads/1.7 069d19817 -> 362255651 refs/heads/master 24a693b48 -> 56e60ca09
ACCUMULO-3945 Use provided zookeeper hosts for tracing when present. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/36225565 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/36225565 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/36225565 Branch: refs/heads/1.7 Commit: 3622556517432540b0ff90997c9e1d4ee3474e6e Parents: 069d198 Author: Josh Elser <els...@apache.org> Authored: Sun Jul 26 19:47:11 2015 -0400 Committer: Josh Elser <els...@apache.org> Committed: Sun Jul 26 19:47:11 2015 -0400 ---------------------------------------------------------------------- .../org/apache/accumulo/shell/ShellOptionsJC.java | 5 +++++ .../apache/accumulo/shell/ShellOptionsJCTest.java | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/36225565/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java index 92ea1a5..01b7ce3 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java +++ b/shell/src/main/java/org/apache/accumulo/shell/ShellOptionsJC.java @@ -315,6 +315,11 @@ public class ShellOptionsJC { clientConfig.withZkHosts(siteConf.get(Property.INSTANCE_ZK_HOST)); } + // If the user provided the hosts, set the ZK for tracing too + if (null != zooKeeperHosts) { + clientConfig.setProperty(ClientProperty.INSTANCE_ZK_HOST, zooKeeperHosts); + } + return clientConfig; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/36225565/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java ---------------------------------------------------------------------- diff --git a/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java b/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java index 0c4e4c7..f8d74ef 100644 --- a/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java +++ b/shell/src/test/java/org/apache/accumulo/shell/ShellOptionsJCTest.java @@ -25,9 +25,6 @@ import org.junit.Test; import com.beust.jcommander.JCommander; -/** - * - */ public class ShellOptionsJCTest { ShellOptionsJC options; @@ -48,4 +45,18 @@ public class ShellOptionsJCTest { assertEquals("true", clientConf.get(ClientProperty.INSTANCE_RPC_SASL_ENABLED)); } + @Test + public void testTraceHosts() throws Exception { + // Set the zk hosts in the client conf directly for tracing + final String zk = "localhost:45454"; + JCommander jc = new JCommander(); + + jc.setProgramName("accumulo shell"); + jc.addObject(options); + jc.parse(new String[] {"-zh", zk}); + ClientConfiguration clientConf = options.getClientConfiguration(); + + assertEquals(zk, clientConf.get(ClientProperty.INSTANCE_ZK_HOST)); + } + }