Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D374C200BE2 for ; Thu, 15 Dec 2016 22:43:39 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id D1FBB160B2D; Thu, 15 Dec 2016 21:43:39 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id DB074160B13 for ; Thu, 15 Dec 2016 22:43:37 +0100 (CET) Received: (qmail 31458 invoked by uid 500); 15 Dec 2016 21:43:37 -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 31447 invoked by uid 99); 15 Dec 2016 21:43:37 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Dec 2016 21:43:37 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D0669E0772; Thu, 15 Dec 2016 21:43:36 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: kturner@apache.org To: commits@accumulo.apache.org Date: Thu, 15 Dec 2016 21:43:36 -0000 Message-Id: <07b1001414e447b7bed957ec58105ae9@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] accumulo-examples git commit: ACCUMULO-1641 Removed use of non public Accumulo command line parsing code. archived-at: Thu, 15 Dec 2016 21:43:40 -0000 Repository: accumulo-examples Updated Branches: refs/heads/master d96c6d968 -> e07cdcde1 http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/filedata/FileDataQuery.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/filedata/FileDataQuery.java b/src/main/java/org/apache/accumulo/examples/filedata/FileDataQuery.java index b034168..00a3dc2 100644 --- a/src/main/java/org/apache/accumulo/examples/filedata/FileDataQuery.java +++ b/src/main/java/org/apache/accumulo/examples/filedata/FileDataQuery.java @@ -23,12 +23,9 @@ import java.util.Map.Entry; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; -import org.apache.accumulo.core.client.ZooKeeperInstance; -import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; @@ -40,15 +37,12 @@ import org.apache.accumulo.core.util.PeekingIterator; * instructions. */ public class FileDataQuery { - private Connector conn = null; List> lastRefs; private ChunkInputStream cis; Scanner scanner; - public FileDataQuery(String instanceName, String zooKeepers, String user, AuthenticationToken token, String tableName, Authorizations auths) + public FileDataQuery(Connector conn, String tableName, Authorizations auths) throws AccumuloException, AccumuloSecurityException, TableNotFoundException { - ZooKeeperInstance instance = new ZooKeeperInstance(ClientConfiguration.loadDefault().withInstance(instanceName).withZkHosts(zooKeepers)); - conn = instance.getConnector(user, token); lastRefs = new ArrayList<>(); cis = new ChunkInputStream(); scanner = conn.createScanner(tableName, auths); http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/helloworld/InsertWithBatchWriter.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/helloworld/InsertWithBatchWriter.java b/src/main/java/org/apache/accumulo/examples/helloworld/InsertWithBatchWriter.java index 8fa9fcf..f61063d 100644 --- a/src/main/java/org/apache/accumulo/examples/helloworld/InsertWithBatchWriter.java +++ b/src/main/java/org/apache/accumulo/examples/helloworld/InsertWithBatchWriter.java @@ -16,8 +16,6 @@ */ package org.apache.accumulo.examples.helloworld; -import org.apache.accumulo.core.cli.BatchWriterOpts; -import org.apache.accumulo.core.cli.ClientOnRequiredTable; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.BatchWriter; @@ -28,6 +26,8 @@ import org.apache.accumulo.core.client.TableExistsException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.BatchWriterOpts; +import org.apache.accumulo.examples.cli.ClientOnRequiredTable; import org.apache.hadoop.io.Text; /** http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/helloworld/ReadData.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/helloworld/ReadData.java b/src/main/java/org/apache/accumulo/examples/helloworld/ReadData.java index 4b9b993..9237e5a 100644 --- a/src/main/java/org/apache/accumulo/examples/helloworld/ReadData.java +++ b/src/main/java/org/apache/accumulo/examples/helloworld/ReadData.java @@ -19,8 +19,6 @@ package org.apache.accumulo.examples.helloworld; import java.util.Iterator; import java.util.Map.Entry; -import org.apache.accumulo.core.cli.ClientOnRequiredTable; -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; @@ -29,6 +27,8 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.ClientOnRequiredTable; +import org.apache.accumulo.examples.cli.ScannerOpts; import org.apache.hadoop.io.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java b/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java index 594330f..dde5cc4 100644 --- a/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java +++ b/src/main/java/org/apache/accumulo/examples/isolation/InterferenceTest.java @@ -19,8 +19,6 @@ package org.apache.accumulo.examples.isolation; import java.util.HashSet; import java.util.Map.Entry; -import org.apache.accumulo.core.cli.BatchWriterOpts; -import org.apache.accumulo.core.cli.ClientOnRequiredTable; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IsolatedScanner; @@ -30,6 +28,8 @@ import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.BatchWriterOpts; +import org.apache.accumulo.examples.cli.ClientOnRequiredTable; import org.apache.hadoop.io.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/NGramIngest.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/NGramIngest.java b/src/main/java/org/apache/accumulo/examples/mapreduce/NGramIngest.java index 9179e3a..fdcc434 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/NGramIngest.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/NGramIngest.java @@ -20,10 +20,10 @@ import java.io.IOException; import java.util.SortedSet; import java.util.TreeSet; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/RegexExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/RegexExample.java b/src/main/java/org/apache/accumulo/examples/mapreduce/RegexExample.java index baf8412..8d00d27 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/RegexExample.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/RegexExample.java @@ -18,12 +18,12 @@ package org.apache.accumulo.examples.mapreduce; import java.io.IOException; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.user.RegExFilter; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java b/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java index b2d0926..f19ecad 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/RowHash.java @@ -20,13 +20,13 @@ import java.io.IOException; import java.util.Base64; import java.util.Collections; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.util.Pair; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.io.MD5Hash; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/TableToFile.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/TableToFile.java b/src/main/java/org/apache/accumulo/examples/mapreduce/TableToFile.java index f1c199d..1813f0c 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/TableToFile.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/TableToFile.java @@ -21,13 +21,13 @@ import java.util.AbstractMap.SimpleImmutableEntry; import java.util.HashSet; import java.util.Map; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.core.util.format.DefaultFormatter; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java b/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java index a8b9b22..bd215aa 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/TeraSortIngest.java @@ -25,11 +25,11 @@ import java.util.ArrayList; import java.util.List; import java.util.Random; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.io.LongWritable; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/UniqueColumns.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/UniqueColumns.java b/src/main/java/org/apache/accumulo/examples/mapreduce/UniqueColumns.java index 42fd651..e3742dc 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/UniqueColumns.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/UniqueColumns.java @@ -20,12 +20,12 @@ import java.io.IOException; import java.util.HashMap; import java.util.HashSet; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/WordCount.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/WordCount.java b/src/main/java/org/apache/accumulo/examples/mapreduce/WordCount.java index 859449d..8a183a2 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/WordCount.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/WordCount.java @@ -18,10 +18,10 @@ package org.apache.accumulo.examples.mapreduce; import java.io.IOException; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.mapreduce.AccumuloOutputFormat; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.Path; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java index 0c8d1ae..9754243 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/BulkIngestExample.java @@ -22,13 +22,13 @@ import java.io.PrintStream; import java.util.Base64; import java.util.Collection; -import org.apache.accumulo.core.cli.MapReduceClientOnRequiredTable; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.mapreduce.AccumuloFileOutputFormat; import org.apache.accumulo.core.client.mapreduce.lib.partition.RangePartitioner; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.util.TextUtil; +import org.apache.accumulo.examples.cli.MapReduceClientOnRequiredTable; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/SetupTable.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/SetupTable.java b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/SetupTable.java index a469fa6..17e549d 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/SetupTable.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/SetupTable.java @@ -20,8 +20,8 @@ import java.util.ArrayList; import java.util.List; import java.util.TreeSet; -import org.apache.accumulo.core.cli.ClientOnRequiredTable; import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.examples.cli.ClientOnRequiredTable; import org.apache.hadoop.io.Text; import com.beust.jcommander.Parameter; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/VerifyIngest.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/VerifyIngest.java b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/VerifyIngest.java index fb47eef..0dead6d 100644 --- a/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/VerifyIngest.java +++ b/src/main/java/org/apache/accumulo/examples/mapreduce/bulk/VerifyIngest.java @@ -19,7 +19,6 @@ package org.apache.accumulo.examples.mapreduce.bulk; import java.util.Iterator; import java.util.Map.Entry; -import org.apache.accumulo.core.cli.ClientOnRequiredTable; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Connector; @@ -28,6 +27,7 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.ClientOnRequiredTable; import org.apache.hadoop.io.Text; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java b/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java index 608607e..35e689d 100644 --- a/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java +++ b/src/main/java/org/apache/accumulo/examples/sample/SampleExample.java @@ -20,8 +20,6 @@ package org.apache.accumulo.examples.sample; import java.util.Collections; import java.util.Map.Entry; -import org.apache.accumulo.core.cli.BatchWriterOpts; -import org.apache.accumulo.core.cli.ClientOnDefaultTable; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.SampleNotPresentException; @@ -34,6 +32,8 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.examples.cli.BatchWriterOpts; +import org.apache.accumulo.examples.cli.ClientOnDefaultTable; import org.apache.accumulo.examples.client.RandomBatchWriter; import org.apache.accumulo.examples.shard.CutoffIntersectingIterator; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/shard/ContinuousQuery.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/shard/ContinuousQuery.java b/src/main/java/org/apache/accumulo/examples/shard/ContinuousQuery.java index 7251148..cabce7a 100644 --- a/src/main/java/org/apache/accumulo/examples/shard/ContinuousQuery.java +++ b/src/main/java/org/apache/accumulo/examples/shard/ContinuousQuery.java @@ -23,8 +23,6 @@ import java.util.Map.Entry; import java.util.Random; import java.util.concurrent.TimeUnit; -import org.apache.accumulo.core.cli.BatchScannerOpts; -import org.apache.accumulo.core.cli.ClientOpts; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IteratorSetting; @@ -33,6 +31,8 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.user.IntersectingIterator; +import org.apache.accumulo.examples.cli.BatchScannerOpts; +import org.apache.accumulo.examples.cli.ClientOpts; import org.apache.hadoop.io.Text; import com.beust.jcommander.Parameter; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/shard/Index.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/shard/Index.java b/src/main/java/org/apache/accumulo/examples/shard/Index.java index 0325e72..92c8a12 100644 --- a/src/main/java/org/apache/accumulo/examples/shard/Index.java +++ b/src/main/java/org/apache/accumulo/examples/shard/Index.java @@ -22,11 +22,11 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; -import org.apache.accumulo.core.cli.BatchWriterOpts; -import org.apache.accumulo.core.cli.ClientOnRequiredTable; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.BatchWriterOpts; +import org.apache.accumulo.examples.cli.ClientOnRequiredTable; import org.apache.hadoop.io.Text; import com.beust.jcommander.Parameter; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/shard/Query.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/shard/Query.java b/src/main/java/org/apache/accumulo/examples/shard/Query.java index 77b459a..e7fe30a 100644 --- a/src/main/java/org/apache/accumulo/examples/shard/Query.java +++ b/src/main/java/org/apache/accumulo/examples/shard/Query.java @@ -22,8 +22,6 @@ import java.util.List; import java.util.Map.Entry; import java.util.concurrent.TimeUnit; -import org.apache.accumulo.core.cli.BatchScannerOpts; -import org.apache.accumulo.core.cli.ClientOnRequiredTable; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IteratorSetting; @@ -32,6 +30,8 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Range; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.user.IntersectingIterator; +import org.apache.accumulo.examples.cli.BatchScannerOpts; +import org.apache.accumulo.examples.cli.ClientOnRequiredTable; import org.apache.hadoop.io.Text; import com.beust.jcommander.Parameter; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/main/java/org/apache/accumulo/examples/shard/Reverse.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/accumulo/examples/shard/Reverse.java b/src/main/java/org/apache/accumulo/examples/shard/Reverse.java index 05be206..26e7f38 100644 --- a/src/main/java/org/apache/accumulo/examples/shard/Reverse.java +++ b/src/main/java/org/apache/accumulo/examples/shard/Reverse.java @@ -18,15 +18,15 @@ package org.apache.accumulo.examples.shard; import java.util.Map.Entry; -import org.apache.accumulo.core.cli.BatchWriterOpts; -import org.apache.accumulo.core.cli.ClientOpts; -import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; +import org.apache.accumulo.examples.cli.BatchWriterOpts; +import org.apache.accumulo.examples.cli.ClientOpts; +import org.apache.accumulo.examples.cli.ScannerOpts; import org.apache.hadoop.io.Text; import com.beust.jcommander.Parameter; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/test/java/org/apache/accumulo/examples/ExamplesIT.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/accumulo/examples/ExamplesIT.java b/src/test/java/org/apache/accumulo/examples/ExamplesIT.java index 51f2473..ea8eaac 100644 --- a/src/test/java/org/apache/accumulo/examples/ExamplesIT.java +++ b/src/test/java/org/apache/accumulo/examples/ExamplesIT.java @@ -23,8 +23,11 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import static org.junit.Assume.assumeTrue; +import java.io.BufferedWriter; import java.io.File; import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -45,7 +48,6 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.MutationsRejectedException; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; @@ -98,7 +100,6 @@ import org.apache.hadoop.util.Tool; import org.junit.After; import org.junit.Assert; import org.junit.Before; -import org.junit.Ignore; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -113,17 +114,11 @@ public class ExamplesIT extends AccumuloClusterHarness { private static final String auths = "A,B"; Connector c; - String instance; - String keepers; - String user; - String passwd; - String keytab; BatchWriter bw; IteratorSetting is; String dir; FileSystem fs; Authorizations origAuths; - boolean saslEnabled; @Override public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopConf) { @@ -134,20 +129,17 @@ public class ExamplesIT extends AccumuloClusterHarness { @Before public void getClusterInfo() throws Exception { c = getConnector(); - user = getAdminPrincipal(); + String user = getAdminPrincipal(); + String instance = c.getInstance().getInstanceName(); + String keepers = c.getInstance().getZooKeepers(); AuthenticationToken token = getAdminToken(); - if (token instanceof KerberosToken) { - keytab = getAdminUser().getKeytab().getAbsolutePath(); - saslEnabled = true; - } else if (token instanceof PasswordToken) { - passwd = new String(((PasswordToken) getAdminToken()).getPassword(), UTF_8); - saslEnabled = false; + if (token instanceof PasswordToken) { + String passwd = new String(((PasswordToken) getAdminToken()).getPassword(), UTF_8); + writeConnectionFile(getConnectionFile(), instance, keepers, user, passwd); } else { Assert.fail("Unknown token type: " + token); } fs = getCluster().getFileSystem(); - instance = c.getInstance().getInstanceName(); - keepers = c.getInstance().getZooKeepers(); dir = new Path(cluster.getTemporaryPath(), getClass().getName()).toString(); origAuths = c.securityOperations().getUserAuthorizations(user); @@ -161,6 +153,19 @@ public class ExamplesIT extends AccumuloClusterHarness { } } + public static void writeConnectionFile(String file, String instance, String keepers, String user, String password) throws IOException { + try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(file))) { + writer.write("instance.zookeeper.host=" + keepers + "\n"); + writer.write("instance.name=" + instance + "\n"); + writer.write("accumulo.examples.principal=" + user + "\n"); + writer.write("accumulo.examples.password=" + password + "\n"); + } + } + + private String getConnectionFile() { + return System.getProperty("user.dir") + "/target/examples.conf"; + } + @Override public int defaultTimeoutSeconds() { return 6 * 60; @@ -175,12 +180,7 @@ public class ExamplesIT extends AccumuloClusterHarness { while (!c.tableOperations().exists("trace")) sleepUninterruptibly(500, TimeUnit.MILLISECONDS); } - String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-C", "-D", "-c"}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-C", "-D", "-c"}; - } + String[] args = new String[] {"-c", getConnectionFile(), "--createtable", "--deletetable", "--create"}; Entry pair = cluster.getClusterControl().execWithStdout(TracingExample.class, args); Assert.assertEquals("Expected return code of zero. STDOUT=" + pair.getValue(), 0, pair.getKey().intValue()); String result = pair.getValue(); @@ -188,11 +188,7 @@ public class ExamplesIT extends AccumuloClusterHarness { Matcher matcher = pattern.matcher(result); int count = 0; while (matcher.find()) { - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--traceid", matcher.group(1)}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--traceid", matcher.group(1)}; - } + args = new String[] {"-c", getConnectionFile(), "--traceid", matcher.group(1)}; pair = cluster.getClusterControl().execWithStdout(TraceDumpExample.class, args); count++; } @@ -239,13 +235,9 @@ public class ExamplesIT extends AccumuloClusterHarness { } assumeTrue(new File(dirListDirectory).exists()); // Index a directory listing on /tmp. If this is running against a standalone cluster, we can't guarantee Accumulo source will be there. - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--dirTable", dirTable, "--indexTable", indexTable, "--dataTable", - dataTable, "--vis", visibility, "--chunkSize", Integer.toString(10000), dirListDirectory}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--dirTable", dirTable, "--indexTable", indexTable, "--dataTable", - dataTable, "--vis", visibility, "--chunkSize", Integer.toString(10000), dirListDirectory}; - } + args = new String[] {"-c", getConnectionFile(), "--dirTable", dirTable, "--indexTable", indexTable, "--dataTable", dataTable, "--vis", visibility, + "--chunkSize", Integer.toString(10000), dirListDirectory}; + Entry entry = getClusterControl().execWithStdout(Ingest.class, args); assertEquals("Got non-zero return code. Stdout=" + entry.getValue(), 0, entry.getKey().intValue()); @@ -262,12 +254,8 @@ public class ExamplesIT extends AccumuloClusterHarness { default: throw new RuntimeException("Unknown cluster type"); } - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "--keytab", keytab, "-u", user, "-t", indexTable, "--auths", auths, "--search", "--path", - expectedFile}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-p", passwd, "-u", user, "-t", indexTable, "--auths", auths, "--search", "--path", expectedFile}; - } + + args = new String[] {"-c", getConnectionFile(), "-t", indexTable, "--auths", auths, "--search", "--path", expectedFile}; entry = getClusterControl().execWithStdout(QueryUtil.class, args); if (ClusterType.MINI == getClusterType()) { MiniAccumuloClusterImpl impl = (MiniAccumuloClusterImpl) cluster; @@ -339,37 +327,22 @@ public class ExamplesIT extends AccumuloClusterHarness { String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); c.tableOperations().setProperty(tableName, Property.TABLE_BLOOM_ENABLED.getKey(), "true"); - String[] args; - if (saslEnabled) { - args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--num", "100000", "--min", "0", "--max", - "1000000000", "--size", "50", "--batchMemory", "2M", "--batchLatency", "60s", "--batchThreads", "3", "-t", tableName}; - } else { - args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "100000", "--min", "0", "--max", "1000000000", - "--size", "50", "--batchMemory", "2M", "--batchLatency", "60s", "--batchThreads", "3", "-t", tableName}; - } + String[] args = new String[] {"--seed", "7", "-c", getConnectionFile(), "--num", "100000", "--min", "0", "--max", "1000000000", "--size", "50", + "--batchMemory", "2M", "--batchLatency", "60", "--batchThreads", "3", "-t", tableName}; + goodExec(RandomBatchWriter.class, args); c.tableOperations().flush(tableName, null, null, true); long diff = 0, diff2 = 0; // try the speed test a couple times in case the system is loaded with other tests for (int i = 0; i < 2; i++) { long now = System.currentTimeMillis(); - if (saslEnabled) { - args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--num", "10000", "--min", "0", "--max", - "1000000000", "--size", "50", "--scanThreads", "4", "-t", tableName}; - } else { - args = new String[] {"--seed", "7", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "10000", "--min", "0", "--max", "1000000000", - "--size", "50", "--scanThreads", "4", "-t", tableName}; - } + args = new String[] {"--seed", "7", "-c", getConnectionFile(), "--num", "10000", "--min", "0", "--max", "1000000000", "--size", "50", "--scanThreads", + "4", "-t", tableName}; goodExec(RandomBatchScanner.class, args); diff = System.currentTimeMillis() - now; now = System.currentTimeMillis(); - if (saslEnabled) { - args = new String[] {"--seed", "8", "-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--num", "10000", "--min", "0", "--max", - "1000000000", "--size", "50", "--scanThreads", "4", "-t", tableName}; - } else { - args = new String[] {"--seed", "8", "-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--num", "10000", "--min", "0", "--max", "1000000000", - "--size", "50", "--scanThreads", "4", "-t", tableName}; - } + args = new String[] {"--seed", "8", "-c", getConnectionFile(), "--num", "10000", "--min", "0", "--max", "1000000000", "--size", "50", "--scanThreads", + "4", "-t", tableName}; int retCode = getClusterControl().exec(RandomBatchScanner.class, args); assertEquals(1, retCode); diff2 = System.currentTimeMillis() - now; @@ -401,22 +374,11 @@ public class ExamplesIT extends AccumuloClusterHarness { } assertTrue(thisFile); - String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", user, "--keytab", keytab}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", getAdminPrincipal(), "-p", passwd}; - } + String[] args = new String[] {"-c", getConnectionFile(), "--shardTable", shard, "--doc2Term", index}; + // create a reverse index goodExec(Reverse.class, args); - - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", user, "--keytab", keytab, "--terms", "5", - "--count", "1000"}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "--shardTable", shard, "--doc2Term", index, "-u", user, "-p", passwd, "--terms", "5", "--count", - "1000"}; - } + args = new String[] {"-c", getConnectionFile(), "--shardTable", shard, "--doc2Term", index, "--terms", "5", "--count", "1000"}; // run some queries goodExec(ContinuousQuery.class, args); } @@ -430,11 +392,7 @@ public class ExamplesIT extends AccumuloClusterHarness { opts.rows = 1; opts.cols = 1000; opts.setTableName(tableName); - if (saslEnabled) { - opts.updateKerberosCredentials(cluster.getClientConfig()); - } else { - opts.setPrincipal(getAdminPrincipal()); - } + opts.setPrincipal(getAdminPrincipal()); try { TestIngest.ingest(c, opts, bwOpts); } catch (MutationsRejectedException ex) { @@ -454,14 +412,7 @@ public class ExamplesIT extends AccumuloClusterHarness { } goodExec(GenerateTestData.class, "--start-row", "0", "--count", "10000", "--output", dir + "/tmp/input/data"); - List commonArgs = new ArrayList<>(Arrays.asList(new String[] {"-i", instance, "-z", keepers, "-u", user, "--table", tableName})); - if (saslEnabled) { - commonArgs.add("--keytab"); - commonArgs.add(keytab); - } else { - commonArgs.add("-p"); - commonArgs.add(passwd); - } + List commonArgs = new ArrayList<>(Arrays.asList(new String[] {"-c", getConnectionFile(), "--table", tableName})); List args = new ArrayList<>(commonArgs); goodExec(SetupTable.class, args.toArray(new String[0])); @@ -480,41 +431,22 @@ public class ExamplesIT extends AccumuloClusterHarness { // TODO Figure out a way to run M/R with Kerberos assumeTrue(getAdminToken() instanceof PasswordToken); String tableName = getUniqueNames(1)[0]; - String[] args; - if (saslEnabled) { - args = new String[] {"--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", tableName, "-i", instance, "-z", keepers, - "-u", user, "--keytab", keytab, "--splits", "4"}; - } else { - args = new String[] {"--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", tableName, "-i", instance, "-z", keepers, - "-u", user, "-p", passwd, "--splits", "4"}; - } + String[] args = new String[] {"--count", (1000 * 1000) + "", "-nk", "10", "-xk", "10", "-nv", "10", "-xv", "10", "-t", tableName, "-c", getConnectionFile(), + "--splits", "4"}; goodExec(TeraSortIngest.class, args); Path output = new Path(dir, "tmp/nines"); if (fs.exists(output)) { fs.delete(output, true); } - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--rowRegex", ".*999.*", "--output", - output.toString()}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--rowRegex", ".*999.*", "--output", output.toString()}; - } + args = new String[] {"-c", getConnectionFile(), "-t", tableName, "--rowRegex", ".*999.*", "--output", output.toString()}; goodExec(RegexExample.class, args); - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--column", "c:"}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--column", "c:"}; - } + args = new String[] {"-c", getConnectionFile(), "-t", tableName, "--column", "c:"}; goodExec(RowHash.class, args); output = new Path(dir, "tmp/tableFile"); if (fs.exists(output)) { fs.delete(output, true); } - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--output", output.toString()}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--output", output.toString()}; - } + args = new String[] {"-c", getConnectionFile(), "-t", tableName, "--output", output.toString()}; goodExec(TableToFile.class, args); } @@ -535,11 +467,7 @@ public class ExamplesIT extends AccumuloClusterHarness { } fs.copyFromLocalFile(readme, new Path(dir + "/tmp/wc/README.md")); String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-u", user, "--keytab", keytab, "-z", keepers, "--input", dir + "/tmp/wc", "-t", tableName}; - } else { - args = new String[] {"-i", instance, "-u", user, "-p", passwd, "-z", keepers, "--input", dir + "/tmp/wc", "-t", tableName}; - } + args = new String[] {"-c", getConnectionFile(), "--input", dir + "/tmp/wc", "-t", tableName}; goodExec(WordCount.class, args); } @@ -547,11 +475,7 @@ public class ExamplesIT extends AccumuloClusterHarness { public void testInsertWithBatchWriterAndReadData() throws Exception { String tableName = getUniqueNames(1)[0]; String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName}; - } + args = new String[] {"-c", getConnectionFile(), "-t", tableName}; goodExec(InsertWithBatchWriter.class, args); goodExec(ReadData.class, args); } @@ -559,33 +483,21 @@ public class ExamplesIT extends AccumuloClusterHarness { @Test public void testIsolatedScansWithInterference() throws Exception { String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", getUniqueNames(1)[0], "--iterations", "100000", "--isolated"}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", getUniqueNames(1)[0], "--iterations", "100000", "--isolated"}; - } + args = new String[] {"-c", getConnectionFile(), "-t", getUniqueNames(1)[0], "--iterations", "100000", "--isolated"}; goodExec(InterferenceTest.class, args); } @Test public void testScansWithInterference() throws Exception { String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", getUniqueNames(1)[0], "--iterations", "100000"}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", getUniqueNames(1)[0], "--iterations", "100000"}; - } + args = new String[] {"-c", getConnectionFile(), "-t", getUniqueNames(1)[0], "--iterations", "100000"}; goodExec(InterferenceTest.class, args); } @Test public void testRowOperations() throws Exception { String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd}; - } + args = new String[] {"-c", getConnectionFile()}; goodExec(RowOperations.class, args); } @@ -594,13 +506,8 @@ public class ExamplesIT extends AccumuloClusterHarness { String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "-t", tableName, "--start", "0", "--num", "100000", "--size", "50", - "--batchMemory", "10000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "-t", tableName, "--start", "0", "--num", "100000", "--size", "50", - "--batchMemory", "10000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}; - } + args = new String[] {"-c", getConnectionFile(), "-t", tableName, "--start", "0", "--num", "100000", "--size", "50", "--batchMemory", "10000000", + "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}; goodExec(SequentialBatchWriter.class, args); } @@ -609,18 +516,9 @@ public class ExamplesIT extends AccumuloClusterHarness { public void testReadWriteAndDelete() throws Exception { String tableName = getUniqueNames(1)[0]; String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--auths", auths, "--table", tableName, "--createtable", "-c", - "--debug"}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", tableName, "--createtable", "-c", "--debug"}; - } + args = new String[] {"-c", getConnectionFile(), "--auths", auths, "--table", tableName, "--createtable", "--create"}; goodExec(ReadWriteExample.class, args); - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--auths", auths, "--table", tableName, "-d", "--debug"}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--auths", auths, "--table", tableName, "-d", "--debug"}; - } + args = new String[] {"-c", getConnectionFile(), "--auths", auths, "--table", tableName, "--delete"}; goodExec(ReadWriteExample.class, args); } @@ -629,30 +527,15 @@ public class ExamplesIT extends AccumuloClusterHarness { public void testRandomBatchesAndFlush() throws Exception { String tableName = getUniqueNames(1)[0]; c.tableOperations().create(tableName); - String[] args; - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName, "--num", "100000", "--min", "0", "--max", - "100000", "--size", "100", "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--num", "100000", "--min", "0", "--max", "100000", - "--size", "100", "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}; - } + String[] args = new String[] {"-c", getConnectionFile(), "--table", tableName, "--num", "100000", "--min", "0", "--max", "100000", "--size", "100", + "--batchMemory", "1000000", "--batchLatency", "1000", "--batchThreads", "4", "--vis", visibility}; goodExec(RandomBatchWriter.class, args); - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName, "--num", "10000", "--min", "0", "--max", - "100000", "--size", "100", "--scanThreads", "4", "--auths", auths}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName, "--num", "10000", "--min", "0", "--max", "100000", - "--size", "100", "--scanThreads", "4", "--auths", auths}; - } + args = new String[] {"-c", getConnectionFile(), "--table", tableName, "--num", "10000", "--min", "0", "--max", "100000", "--size", "100", "--scanThreads", + "4", "--auths", auths}; goodExec(RandomBatchScanner.class, args); - if (saslEnabled) { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "--keytab", keytab, "--table", tableName}; - } else { - args = new String[] {"-i", instance, "-z", keepers, "-u", user, "-p", passwd, "--table", tableName}; - } + args = new String[] {"-c", getConnectionFile(), "--table", tableName}; goodExec(Flush.class, args); } http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java b/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java index 5330fe2..e243f49 100644 --- a/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java +++ b/src/test/java/org/apache/accumulo/examples/dirlist/CountIT.java @@ -22,8 +22,6 @@ import static org.junit.Assert.assertFalse; import java.util.ArrayList; import java.util.Map.Entry; -import org.apache.accumulo.core.cli.BatchWriterOpts; -import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; @@ -33,10 +31,8 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; import org.apache.accumulo.core.util.Pair; -import org.apache.accumulo.examples.dirlist.FileCount; -import org.apache.accumulo.examples.dirlist.FileCount.Opts; -import org.apache.accumulo.examples.dirlist.Ingest; -import org.apache.accumulo.examples.dirlist.QueryUtil; +import org.apache.accumulo.examples.cli.BatchWriterOpts; +import org.apache.accumulo.examples.cli.ScannerOpts; import org.apache.accumulo.test.functional.ConfigurableMacBase; import org.apache.hadoop.io.Text; import org.junit.Before; @@ -73,15 +69,9 @@ public class CountIT extends ConfigurableMacBase { scanner.fetchColumn(new Text("dir"), new Text("counts")); assertFalse(scanner.iterator().hasNext()); - Opts opts = new Opts(); ScannerOpts scanOpts = new ScannerOpts(); BatchWriterOpts bwOpts = new BatchWriterOpts(); - opts.instance = conn.getInstance().getInstanceName(); - opts.zookeepers = conn.getInstance().getZooKeepers(); - opts.setTableName(tableName); - opts.setPrincipal(conn.whoami()); - opts.setPassword(new Opts.Password(ROOT_PASSWORD)); - FileCount fc = new FileCount(opts, scanOpts, bwOpts); + FileCount fc = new FileCount(conn, tableName, Authorizations.EMPTY, new ColumnVisibility(), scanOpts, bwOpts); fc.run(); ArrayList> expected = new ArrayList<>(); http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/test/java/org/apache/accumulo/examples/filedata/ChunkCombinerTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/accumulo/examples/filedata/ChunkCombinerTest.java b/src/test/java/org/apache/accumulo/examples/filedata/ChunkCombinerTest.java index 881bbdf..515aea5 100644 --- a/src/test/java/org/apache/accumulo/examples/filedata/ChunkCombinerTest.java +++ b/src/test/java/org/apache/accumulo/examples/filedata/ChunkCombinerTest.java @@ -26,8 +26,6 @@ import java.util.Map.Entry; import java.util.SortedMap; import java.util.TreeMap; -import junit.framework.TestCase; - import org.apache.accumulo.core.data.ByteSequence; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.PartialKey; @@ -36,6 +34,8 @@ import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.IteratorEnvironment; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; +import junit.framework.TestCase; + public class ChunkCombinerTest extends TestCase { public static class MapIterator implements SortedKeyValueIterator { http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java index 8c23ea6..aa56c1b 100644 --- a/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java +++ b/src/test/java/org/apache/accumulo/examples/filedata/ChunkInputFormatIT.java @@ -37,7 +37,6 @@ import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.security.ColumnVisibility; -import org.apache.accumulo.examples.filedata.ChunkInputFormat; import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/test/java/org/apache/accumulo/examples/filedata/KeyUtilTest.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/accumulo/examples/filedata/KeyUtilTest.java b/src/test/java/org/apache/accumulo/examples/filedata/KeyUtilTest.java index c0fe72c..7f28882 100644 --- a/src/test/java/org/apache/accumulo/examples/filedata/KeyUtilTest.java +++ b/src/test/java/org/apache/accumulo/examples/filedata/KeyUtilTest.java @@ -16,10 +16,10 @@ */ package org.apache.accumulo.examples.filedata; -import junit.framework.TestCase; - import org.apache.hadoop.io.Text; +import junit.framework.TestCase; + public class KeyUtilTest extends TestCase { public static void checkSeps(String... s) { Text t = KeyUtil.buildNullSepText(s); http://git-wip-us.apache.org/repos/asf/accumulo-examples/blob/e07cdcde/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java ---------------------------------------------------------------------- diff --git a/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java b/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java index c8fdec3..55975b6 100644 --- a/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java +++ b/src/test/java/org/apache/accumulo/examples/mapreduce/MapReduceIT.java @@ -38,6 +38,7 @@ import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.security.Authorizations; +import org.apache.accumulo.examples.ExamplesIT; import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; import org.apache.accumulo.test.functional.ConfigurableMacBase; import org.apache.hadoop.io.Text; @@ -61,10 +62,14 @@ public class MapReduceIT extends ConfigurableMacBase { @Test public void test() throws Exception { - runTest(getConnector(), getCluster()); + String confFile = System.getProperty("user.dir")+"/target/examples.conf"; + String instance = getConnector().getInstance().getInstanceName(); + String keepers = getConnector().getInstance().getZooKeepers(); + ExamplesIT.writeConnectionFile(confFile, instance, keepers, "root", ROOT_PASSWORD); + runTest(confFile, getConnector(), getCluster()); } - static void runTest(Connector c, MiniAccumuloClusterImpl cluster) throws AccumuloException, AccumuloSecurityException, TableExistsException, + static void runTest(String confFile, Connector c, MiniAccumuloClusterImpl cluster) throws AccumuloException, AccumuloSecurityException, TableExistsException, TableNotFoundException, MutationsRejectedException, IOException, InterruptedException, NoSuchAlgorithmException { c.tableOperations().create(tablename); BatchWriter bw = c.createBatchWriter(tablename, new BatchWriterConfig()); @@ -74,8 +79,7 @@ public class MapReduceIT extends ConfigurableMacBase { bw.addMutation(m); } bw.close(); - Process hash = cluster.exec(RowHash.class, Collections.singletonList(hadoopTmpDirArg), "-i", c.getInstance().getInstanceName(), "-z", c.getInstance() - .getZooKeepers(), "-u", "root", "-p", ROOT_PASSWORD, "-t", tablename, "--column", input_cfcq); + Process hash = cluster.exec(RowHash.class, Collections.singletonList(hadoopTmpDirArg), "-c", confFile, "-t", tablename, "--column", input_cfcq); assertEquals(0, hash.waitFor()); Scanner s = c.createScanner(tablename, Authorizations.EMPTY);