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 5F09410265 for ; Sat, 1 Feb 2014 03:23:34 +0000 (UTC) Received: (qmail 69513 invoked by uid 500); 1 Feb 2014 03:23:33 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 69412 invoked by uid 500); 1 Feb 2014 03:23:32 -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 67824 invoked by uid 99); 1 Feb 2014 03:23:05 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Feb 2014 03:23:05 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 1041E8C09E1; Sat, 1 Feb 2014 03:23:03 +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: Sat, 01 Feb 2014 03:23:20 -0000 Message-Id: In-Reply-To: <40fa21bd2f504f478a68fbe0a4f7e4a7@git.apache.org> References: <40fa21bd2f504f478a68fbe0a4f7e4a7@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [21/26] git commit: UTF8 and Integer/Long fixes to the test module UTF8 and Integer/Long fixes to the test module Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/990da6ae Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/990da6ae Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/990da6ae Branch: refs/heads/2292-findbugs Commit: 990da6ae4bae003ab0a5b9b42bc791e945acaf69 Parents: 8181a39 Author: Josh Elser Authored: Fri Jan 31 19:31:08 2014 -0500 Committer: Josh Elser Committed: Fri Jan 31 22:18:53 2014 -0500 ---------------------------------------------------------------------- .../accumulo/test/BulkImportDirectory.java | 5 +++-- .../apache/accumulo/test/CreateTestTable.java | 2 +- .../accumulo/test/NativeMapConcurrencyTest.java | 2 +- .../accumulo/test/NativeMapPerformanceTest.java | 7 +++--- .../accumulo/test/NativeMapStressTest.java | 2 +- .../apache/accumulo/test/TestBinaryRows.java | 20 ++++++++++------- .../org/apache/accumulo/test/TestIngest.java | 5 +++-- .../accumulo/test/TestMultiTableIngest.java | 3 ++- .../org/apache/accumulo/test/VerifyIngest.java | 2 +- .../test/continuous/ContinuousIngest.java | 6 ++--- .../test/continuous/ContinuousMoru.java | 5 +++-- .../test/continuous/ContinuousQuery.java | 3 ++- .../test/continuous/ContinuousScanner.java | 3 ++- .../test/continuous/ContinuousVerify.java | 5 +++-- .../test/continuous/ContinuousWalk.java | 14 ++++++------ .../accumulo/test/continuous/Histogram.java | 4 +++- .../test/continuous/PrintScanTimeHistogram.java | 4 +++- .../accumulo/test/continuous/TimeBinner.java | 3 ++- .../test/continuous/UndefinedAnalyzer.java | 18 ++++++++------- .../accumulo/test/functional/AddSplitTest.java | 2 +- .../test/functional/BadIteratorMincTest.java | 4 ++-- .../test/functional/BatchScanSplitTest.java | 4 ++-- .../test/functional/BatchWriterFlushTest.java | 2 +- .../test/functional/BloomFilterTest.java | 8 +++---- .../accumulo/test/functional/BulkFileTest.java | 2 +- .../functional/BulkSplitOptimizationTest.java | 3 ++- .../test/functional/CacheTestReader.java | 5 +++-- .../test/functional/CacheTestWriter.java | 9 ++++---- .../test/functional/ConcurrencyTest.java | 4 ++-- .../test/functional/ConstraintTest.java | 20 ++++++++--------- .../test/functional/CreateAndUseTest.java | 2 +- .../test/functional/DeleteEverythingTest.java | 2 +- .../test/functional/DeleteRowsSplitTest.java | 4 ++-- .../test/functional/FunctionalTest.java | 2 +- .../accumulo/test/functional/LargeRowTest.java | 4 ++-- .../accumulo/test/functional/NativeMapTest.java | 23 ++++++++++---------- .../test/functional/PermissionsTest.java | 6 ++--- .../accumulo/test/functional/RunTests.java | 3 ++- .../test/functional/ScanIteratorTest.java | 5 +++-- .../accumulo/test/functional/ScanRangeTest.java | 2 +- .../test/functional/ScanSessionTimeOutTest.java | 3 ++- .../test/functional/ServerSideErrorTest.java | 2 +- .../test/functional/SplitRecoveryTest.java | 4 ++-- .../test/functional/VisibilityTest.java | 9 ++++---- .../accumulo/test/functional/ZombieTServer.java | 2 +- .../metadata/MetadataBatchScanTest.java | 4 ++-- .../apache/accumulo/test/randomwalk/Module.java | 5 +++-- .../test/randomwalk/bulk/BulkMinusOne.java | 2 +- .../test/randomwalk/bulk/BulkPlusOne.java | 3 +-- .../accumulo/test/randomwalk/bulk/Verify.java | 5 +++-- .../test/randomwalk/concurrent/BatchWrite.java | 3 ++- .../test/randomwalk/concurrent/BulkImport.java | 3 ++- .../concurrent/ChangeAuthorizations.java | 5 +++-- .../randomwalk/concurrent/CheckBalance.java | 2 +- .../randomwalk/concurrent/StopTabletServer.java | 2 +- .../accumulo/test/randomwalk/image/Commit.java | 2 +- .../test/randomwalk/image/ImageFixture.java | 6 ++--- .../accumulo/test/randomwalk/image/Verify.java | 7 +++--- .../accumulo/test/randomwalk/image/Write.java | 7 +++--- .../test/randomwalk/multitable/Commit.java | 2 +- .../test/randomwalk/multitable/CopyTable.java | 2 +- .../test/randomwalk/multitable/CreateTable.java | 2 +- .../multitable/MultiTableFixture.java | 6 ++--- .../test/randomwalk/multitable/Write.java | 3 ++- .../randomwalk/security/SecurityHelper.java | 6 ++--- .../test/randomwalk/security/TableOp.java | 7 +++--- .../randomwalk/security/WalkingSecurity.java | 2 +- .../test/randomwalk/sequential/Commit.java | 2 +- .../randomwalk/sequential/MapRedVerifyTool.java | 2 +- .../sequential/SequentialFixture.java | 4 ++-- .../test/randomwalk/sequential/Write.java | 3 ++- .../test/randomwalk/shard/BulkInsert.java | 7 +++--- .../test/randomwalk/shard/ExportIndex.java | 2 +- .../accumulo/test/randomwalk/shard/Insert.java | 2 +- .../test/randomwalk/shard/ShardFixture.java | 4 ++-- .../accumulo/test/scalability/Ingest.java | 3 ++- 76 files changed, 201 insertions(+), 163 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java b/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java index 48cbde8..3807625 100644 --- a/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java +++ b/test/src/main/java/org/apache/accumulo/test/BulkImportDirectory.java @@ -20,12 +20,13 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.accumulo.server.cli.ClientOnRequiredTable; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.util.CachedConfiguration; +import org.apache.accumulo.server.cli.ClientOnRequiredTable; import org.apache.accumulo.server.client.HdfsZooInstance; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; @@ -49,7 +50,7 @@ public class BulkImportDirectory { if (args.length == 5) { System.err.println("Deprecated syntax for BulkImportDirectory, please use the new style (see --help)"); final String user = args[0]; - final byte[] pass = args[1].getBytes(); + final byte[] pass = args[1].getBytes(Constants.UTF8); final String tableName = args[2]; final String dir = args[3]; final String failureDir = args[4]; http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java b/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java index 14c5cef..4d69d8a 100644 --- a/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java +++ b/test/src/main/java/org/apache/accumulo/test/CreateTestTable.java @@ -78,7 +78,7 @@ public class CreateTestTable { // populate for (int i = 0; i < opts.count; i++) { Mutation m = new Mutation(new Text(String.format("%05d", i))); - m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes())); + m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes(Constants.UTF8))); b.addMutation(m); } b.close(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java b/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java index 79dc48d..ed56cb0 100644 --- a/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java +++ b/test/src/main/java/org/apache/accumulo/test/NativeMapConcurrencyTest.java @@ -60,7 +60,7 @@ public class NativeMapConcurrencyTest { for (int i = 0; i < numRows; i++) { Mutation m = nm(i + start); for (int j = 0; j < numCols; j++) { - Value val = new Value("test".getBytes()); + Value val = new Value("test".getBytes(Constants.UTF8)); pc(m, j, val); } nm.mutate(m, mc++); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java b/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java index a63b777..73b73f4 100644 --- a/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java +++ b/test/src/main/java/org/apache/accumulo/test/NativeMapPerformanceTest.java @@ -18,12 +18,13 @@ package org.apache.accumulo.test; import java.util.Collections; import java.util.Iterator; +import java.util.Map.Entry; import java.util.Random; import java.util.SortedMap; import java.util.TreeMap; -import java.util.Map.Entry; import java.util.concurrent.ConcurrentSkipListMap; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; @@ -76,7 +77,7 @@ public class NativeMapPerformanceTest { Mutation m = nm(row); for (int j = 0; j < numCols; j++) { int col = rand.nextInt(1000000); - Value val = new Value("test".getBytes()); + Value val = new Value("test".getBytes(Constants.UTF8)); pc(m, col, val); } nm.mutate(m, i); @@ -87,7 +88,7 @@ public class NativeMapPerformanceTest { for (int j = 0; j < numCols; j++) { int col = rand.nextInt(1000000); Key key = nk(row, col); - Value val = new Value("test".getBytes()); + Value val = new Value("test".getBytes(Constants.UTF8)); tm.put(key, val); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java b/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java index 2d0bd45..00d0d93 100644 --- a/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java +++ b/test/src/main/java/org/apache/accumulo/test/NativeMapStressTest.java @@ -49,7 +49,7 @@ public class NativeMapStressTest { private static void put(NativeMap nm, String row, String val, int mc) { Mutation m = new Mutation(new Text(row)); - m.put(new Text(), new Text(), Long.MAX_VALUE, new Value(val.getBytes())); + m.put(new Text(), new Text(), Long.MAX_VALUE, new Value(val.getBytes(Constants.UTF8))); nm.mutate(m, mc); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java index 0e2735f..f48b8cf 100644 --- a/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java +++ b/test/src/main/java/org/apache/accumulo/test/TestBinaryRows.java @@ -21,6 +21,7 @@ import java.util.Map.Entry; import java.util.Random; import java.util.TreeSet; +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.BatchWriter; @@ -88,6 +89,9 @@ public class TestBinaryRows { try { Connector connector = opts.getConnector(); + final Text CF = new Text("cf"), CQ = new Text("cq"); + final byte[] CF_BYTES = "cf".getBytes(Constants.UTF8), CQ_BYTES = "cq".getBytes(Constants.UTF8); + if (opts.mode.equals("ingest") || opts.mode.equals("delete")) { BatchWriter bw = connector.createBatchWriter(opts.tableName, bwOpts.getBatchWriterConfig()); boolean delete = opts.mode.equals("delete"); @@ -98,9 +102,9 @@ public class TestBinaryRows { Mutation m = new Mutation(new Text(row)); if (delete) { - m.putDelete(new Text("cf"), new Text("cq")); + m.putDelete(CF, CQ); } else { - m.put(new Text("cf"), new Text("cq"), new Value(value.getBytes())); + m.put(CF, CQ, new Value(value.getBytes(Constants.UTF8))); } bw.addMutation(m); } @@ -109,8 +113,8 @@ public class TestBinaryRows { } else if (opts.mode.equals("verifyDeleted")) { Scanner s = connector.createScanner(opts.tableName, opts.auths); s.setBatchSize(scanOpts.scanBatchSize); - Key startKey = new Key(encodeLong(opts.start), "cf".getBytes(), "cq".getBytes(), new byte[0], Long.MAX_VALUE); - Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), "cf".getBytes(), "cq".getBytes(), new byte[0], 0); + Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE); + Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0); s.setBatchSize(50000); s.setRange(new Range(startKey, stopKey)); @@ -124,8 +128,8 @@ public class TestBinaryRows { long t1 = System.currentTimeMillis(); Scanner s = connector.createScanner(opts.tableName, opts.auths); - Key startKey = new Key(encodeLong(opts.start), "cf".getBytes(), "cq".getBytes(), new byte[0], Long.MAX_VALUE); - Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), "cf".getBytes(), "cq".getBytes(), new byte[0], 0); + Key startKey = new Key(encodeLong(opts.start), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE); + Key stopKey = new Key(encodeLong(opts.start + opts.num - 1), CF_BYTES, CQ_BYTES, new byte[0], 0); s.setBatchSize(scanOpts.scanBatchSize); s.setRange(new Range(startKey, stopKey)); @@ -166,8 +170,8 @@ public class TestBinaryRows { Scanner s = connector.createScanner(opts.tableName, opts.auths); s.setBatchSize(scanOpts.scanBatchSize); - Key startKey = new Key(encodeLong(row), "cf".getBytes(), "cq".getBytes(), new byte[0], Long.MAX_VALUE); - Key stopKey = new Key(encodeLong(row), "cf".getBytes(), "cq".getBytes(), new byte[0], 0); + Key startKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], Long.MAX_VALUE); + Key stopKey = new Key(encodeLong(row), CF_BYTES, CQ_BYTES, new byte[0], 0); s.setRange(new Range(startKey, stopKey)); Iterator> si = s.iterator(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/TestIngest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/TestIngest.java b/test/src/main/java/org/apache/accumulo/test/TestIngest.java index 73fa400..33c3b0c 100644 --- a/test/src/main/java/org/apache/accumulo/test/TestIngest.java +++ b/test/src/main/java/org/apache/accumulo/test/TestIngest.java @@ -21,6 +21,7 @@ import java.util.Random; import java.util.Set; import java.util.TreeSet; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; @@ -150,8 +151,8 @@ public class TestIngest { return bytevals; } - private static byte ROW_PREFIX[] = "row_".getBytes(); - private static byte COL_PREFIX[] = "col_".getBytes(); + private static byte ROW_PREFIX[] = "row_".getBytes(Constants.UTF8); + private static byte COL_PREFIX[] = "col_".getBytes(Constants.UTF8); public static Text generateRow(int rowid, int startRow) { return new Text(FastFormat.toZeroPaddedString(rowid + startRow, 10, 10, ROW_PREFIX)); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java index a65e01b..46174b5 100644 --- a/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java +++ b/test/src/main/java/org/apache/accumulo/test/TestMultiTableIngest.java @@ -19,6 +19,7 @@ package org.apache.accumulo.test; import java.util.ArrayList; import java.util.Map.Entry; +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; @@ -96,7 +97,7 @@ public class TestMultiTableIngest { // populate for (int i = 0; i < opts.count; i++) { Mutation m = new Mutation(new Text(String.format("%05d", i))); - m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes())); + m.put(new Text("col" + Integer.toString((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes(Constants.UTF8))); b.getBatchWriter(tableNames.get(i % tableNames.size())).addMutation(m); } try { http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java b/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java index 935c3a7..7106d9a 100644 --- a/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java +++ b/test/src/main/java/org/apache/accumulo/test/VerifyIngest.java @@ -186,7 +186,7 @@ public class VerifyIngest { if (entry.getValue().compareTo(value) != 0) { log.error("unexpected value, rowNum : " + rowNum + " colNum : " + colNum); - log.error(" saw = " + new String(entry.getValue().get()) + " expected = " + new String(value)); + log.error(" saw = " + new String(entry.getValue().get()) + " expected = " + new String(value, Constants.UTF8)); errors++; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java index ac8d30c..23cf15d 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousIngest.java @@ -120,7 +120,7 @@ public class ContinuousIngest { visibilities = new ArrayList(); FileSystem fs = FileSystem.get(new Configuration()); - BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(opts.visFile)))); + BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(opts.visFile)), Constants.UTF8)); String line; @@ -158,9 +158,9 @@ public class ContinuousIngest { Random r = new Random(); - byte[] ingestInstanceId = UUID.randomUUID().toString().getBytes(); + byte[] ingestInstanceId = UUID.randomUUID().toString().getBytes(Constants.UTF8); - System.out.printf("UUID %d %s%n", System.currentTimeMillis(), new String(ingestInstanceId)); + System.out.printf("UUID %d %s%n", System.currentTimeMillis(), new String(ingestInstanceId, Constants.UTF8)); long count = 0; final int flushInterval = 1000000; http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java index 585dc90..bbe7fa3 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousMoru.java @@ -21,6 +21,7 @@ import java.util.Random; import java.util.Set; import java.util.UUID; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.BatchWriterOpts; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; @@ -86,7 +87,7 @@ public class ContinuousMoru extends Configured implements Tool { random = new Random(); ingestInstanceId = context.getConfiguration().get(CI_ID); - iiId = ingestInstanceId.getBytes(); + iiId = ingestInstanceId.getBytes(Constants.UTF8); count = 0; } @@ -102,7 +103,7 @@ public class ContinuousMoru extends Configured implements Tool { int offset = ContinuousWalk.getPrevRowOffset(val); if (offset > 0) { - long rowLong = Long.parseLong(new String(val, offset, 16), 16); + long rowLong = Long.parseLong(new String(val, offset, 16, Constants.UTF8), 16); Mutation m = ContinuousIngest.genMutation(rowLong, random.nextInt(max_cf), random.nextInt(max_cq), EMPTY_VIS, iiId, count++, key.getRowData() .toArray(), random, true); context.write(null, m); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java index 7bb5663..117c136 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousQuery.java @@ -19,6 +19,7 @@ package org.apache.accumulo.test.continuous; import java.util.Map.Entry; import java.util.Random; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; @@ -61,7 +62,7 @@ public class ContinuousQuery { } long t2 = System.currentTimeMillis(); - System.out.printf("SRQ %d %s %d %d%n", t1, new String(row), (t2 - t1), count); + System.out.printf("SRQ %d %s %d %d%n", t1, new String(row, Constants.UTF8), (t2 - t1), count); if (opts.sleepTime > 0) Thread.sleep(opts.sleepTime); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java index 00e4b36..c331bab 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousScanner.java @@ -20,6 +20,7 @@ import java.util.Iterator; import java.util.Map.Entry; import java.util.Random; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.ScannerOpts; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; @@ -93,7 +94,7 @@ public class ContinuousScanner { // System.out.println("P2 "+delta +" "+numToScan+" "+distance+" "+((double)numToScan/count )); } - System.out.printf("SCN %d %s %d %d%n", t1, new String(scanStart), (t2 - t1), count); + System.out.printf("SCN %d %s %d %d%n", t1, new String(scanStart, Constants.UTF8), (t2 - t1), count); if (opts.sleepTime > 0) UtilWaitThread.sleep(opts.sleepTime); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java index e0c2fe5..a5a6a2b 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousVerify.java @@ -24,6 +24,7 @@ import java.util.HashSet; import java.util.Random; import java.util.Set; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.ClientOnDefaultTable; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.mapreduce.AccumuloInputFormat; @@ -108,7 +109,7 @@ public class ContinuousVerify extends Configured implements Tool { int offset = ContinuousWalk.getPrevRowOffset(val); if (offset > 0) { - ref.set(Long.parseLong(new String(val, offset, 16), 16)); + ref.set(Long.parseLong(new String(val, offset, 16, Constants.UTF8), 16)); vrow.set(r); context.write(ref, vrow); } @@ -142,7 +143,7 @@ public class ContinuousVerify extends Configured implements Tool { for (Long ref : refs) { sb.append(comma); comma = ","; - sb.append(new String(ContinuousIngest.genRow(ref))); + sb.append(new String(ContinuousIngest.genRow(ref), Constants.UTF8)); } context.write(new Text(ContinuousIngest.genRow(key.get())), new Text(sb.toString())); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java index 469eabf..4032dfa 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/ContinuousWalk.java @@ -86,7 +86,7 @@ public class ContinuousWalk { auths = new ArrayList(); FileSystem fs = FileSystem.get(new Configuration()); - BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(file)))); + BufferedReader in = new BufferedReader(new InputStreamReader(fs.open(new Path(file)), Constants.UTF8)); try { String line; while ((line = in.readLine()) != null) { @@ -173,7 +173,7 @@ public class ContinuousWalk { long t2 = System.currentTimeMillis(); - System.out.printf("FSR %d %s %d %d%n", t1, new String(scanStart), (t2 - t1), count); + System.out.printf("FSR %d %s %d %d%n", t1, new String(scanStart, Constants.UTF8), (t2 - t1), count); return pr; } @@ -182,12 +182,12 @@ public class ContinuousWalk { if (val.length == 0) throw new IllegalArgumentException(); if (val[53] != ':') - throw new IllegalArgumentException(new String(val)); + throw new IllegalArgumentException(new String(val, Constants.UTF8)); // prev row starts at 54 if (val[54] != ':') { if (val[54 + 16] != ':') - throw new IllegalArgumentException(new String(val)); + throw new IllegalArgumentException(new String(val, Constants.UTF8)); return 54; } @@ -199,7 +199,7 @@ public class ContinuousWalk { byte[] val = value.get(); int offset = getPrevRowOffset(val); if (offset > 0) { - return new String(val, offset, 16); + return new String(val, offset, 16, Constants.UTF8); } return null; @@ -208,7 +208,7 @@ public class ContinuousWalk { static int getChecksumOffset(byte val[]) { if (val[val.length - 1] != ':') { if (val[val.length - 9] != ':') - throw new IllegalArgumentException(new String(val)); + throw new IllegalArgumentException(new String(val, Constants.UTF8)); return val.length - 8; } @@ -220,7 +220,7 @@ public class ContinuousWalk { if (ckOff < 0) return; - long storedCksum = Long.parseLong(new String(value.get(), ckOff, 8), 16); + long storedCksum = Long.parseLong(new String(value.get(), ckOff, 8, Constants.UTF8), 16); CRC32 cksum = new CRC32(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java b/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java index 1f36026..f1657b7 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/Histogram.java @@ -30,6 +30,8 @@ import java.util.List; import java.util.Set; import java.util.TreeSet; +import org.apache.accumulo.core.Constants; + class HistData implements Comparable>, Serializable { private static final long serialVersionUID = 1L; @@ -147,7 +149,7 @@ public class Histogram implements Serializable { FileOutputStream fos = new FileOutputStream(file); BufferedOutputStream bos = new BufferedOutputStream(fos); - PrintStream ps = new PrintStream(bos); + PrintStream ps = new PrintStream(bos, false, Constants.UTF8.name()); TreeSet> sortedCounts = new TreeSet>(counts.values()); for (Iterator> iter = sortedCounts.iterator(); iter.hasNext();) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java b/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java index 896c23a..fc5262b 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/PrintScanTimeHistogram.java @@ -22,6 +22,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import org.apache.accumulo.core.Constants; + public class PrintScanTimeHistogram { public static void main(String[] args) throws Exception { @@ -43,7 +45,7 @@ public class PrintScanTimeHistogram { private static void processFile(InputStream ins, Histogram srqHist, Histogram fsrHist) throws FileNotFoundException, IOException { String line; - BufferedReader in = new BufferedReader(new InputStreamReader(ins)); + BufferedReader in = new BufferedReader(new InputStreamReader(ins, Constants.UTF8)); while ((line = in.readLine()) != null) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java index 286fd5e..2f22f36 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/TimeBinner.java @@ -25,6 +25,7 @@ import java.util.Map.Entry; import java.util.Set; import java.util.TreeMap; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.ClientOpts.TimeConverter; import org.apache.accumulo.core.cli.Help; @@ -71,7 +72,7 @@ public class TimeBinner { Operation operation = Operation.valueOf(opts.operation); SimpleDateFormat sdf = new SimpleDateFormat(opts.dateFormat); - BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + BufferedReader in = new BufferedReader(new InputStreamReader(System.in, Constants.UTF8)); String line = null; http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java b/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java index 1c60640..d424175 100644 --- a/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java +++ b/test/src/main/java/org/apache/accumulo/test/continuous/UndefinedAnalyzer.java @@ -18,6 +18,7 @@ package org.apache.accumulo.test.continuous; import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; import java.io.FileReader; import java.io.FilenameFilter; import java.io.InputStreamReader; @@ -34,7 +35,7 @@ import java.util.Map.Entry; import java.util.TreeMap; import java.util.concurrent.TimeUnit; -import org.apache.accumulo.server.cli.ClientOnDefaultTable; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.BatchScannerOpts; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.Connector; @@ -42,6 +43,7 @@ import org.apache.accumulo.core.client.impl.Tables; 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.server.cli.ClientOnDefaultTable; import org.apache.hadoop.io.Text; import com.beust.jcommander.Parameter; @@ -82,7 +84,7 @@ public class UndefinedAnalyzer { } private void parseLog(File log) throws Exception { - BufferedReader reader = new BufferedReader(new FileReader(log)); + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(log), Constants.UTF8)); String line; TreeMap tm = null; try { @@ -143,10 +145,10 @@ public class UndefinedAnalyzer { long time; TabletAssignment(String tablet, String er, String per, String server, long time) { - this.tablet = new String(tablet); - this.endRow = new String(er); - this.prevEndRow = new String(per); - this.server = new String(server); + this.tablet = tablet; + this.endRow = er; + this.prevEndRow = per; + this.server = server; this.time = time; } @@ -173,7 +175,7 @@ public class UndefinedAnalyzer { for (File masterLog : masterLogs) { - BufferedReader reader = new BufferedReader(new FileReader(masterLog)); + BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(masterLog), Constants.UTF8)); String line; try { while ((line = reader.readLine()) != null) { @@ -254,7 +256,7 @@ public class UndefinedAnalyzer { List undefs = new ArrayList(); - BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in, Constants.UTF8)); String line; while ((line = reader.readLine()) != null) { String[] tokens = line.split("\\s"); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java index 42435d8..8027754 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitTest.java @@ -138,7 +138,7 @@ public class AddSplitTest extends FunctionalTest { String row = String.format("%09d", i); Mutation m = new Mutation(new Text(row)); - m.put(new Text("cf1"), new Text("cq1"), ts, new Value(("" + i).getBytes())); + m.put(new Text("cf1"), new Text("cq1"), ts, new Value(Integer.toString(i).getBytes(Constants.UTF8))); bw.addMutation(m); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java index da2403e..60400ea 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincTest.java @@ -56,7 +56,7 @@ public class BadIteratorMincTest extends FunctionalTest { BatchWriter bw = getConnector().createBatchWriter("foo", new BatchWriterConfig()); Mutation m = new Mutation(new Text("r1")); - m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes())); + m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes(Constants.UTF8))); bw.addMutation(m); @@ -101,7 +101,7 @@ public class BadIteratorMincTest extends FunctionalTest { getConnector().tableOperations().setProperty("foo", Property.TABLE_ITERATOR_PREFIX.getKey() + "minc.badi", "30," + BadIterator.class.getName()); bw = getConnector().createBatchWriter("foo", new BatchWriterConfig()); m = new Mutation(new Text("r2")); - m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes())); + m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes(Constants.UTF8))); bw.addMutation(m); bw.close(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java index 41a532c..3ebfb51 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitTest.java @@ -65,7 +65,7 @@ public class BatchScanSplitTest extends FunctionalTest { for (int i = 0; i < numRows; i++) { Mutation m = new Mutation(new Text(String.format("%09x", i))); - m.put(new Text("cf1"), new Text("cq1"), new Value(String.format("%016x", numRows - i).getBytes())); + m.put(new Text("cf1"), new Text("cq1"), new Value(String.format("%016x", numRows - i).getBytes(Constants.UTF8))); bw.addMutation(m); } @@ -89,7 +89,7 @@ public class BatchScanSplitTest extends FunctionalTest { for (int i = 0; i < 100; i++) { int r = random.nextInt(numRows); Text row = new Text(String.format("%09x", r)); - expected.put(row, new Value(String.format("%016x", numRows - r).getBytes())); + expected.put(row, new Value(String.format("%016x", numRows - r).getBytes(Constants.UTF8))); ranges.add(new Range(row)); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java index 25aaf94..d649864 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushTest.java @@ -76,7 +76,7 @@ public class BatchWriterFlushTest extends FunctionalTest { Scanner scanner = getConnector().createScanner("bwlt", Constants.NO_AUTHS); Mutation m = new Mutation(new Text(String.format("r_%10d", 1))); - m.put(new Text("cf"), new Text("cq"), new Value(("" + 1).getBytes())); + m.put(new Text("cf"), new Text("cq"), new Value("1".getBytes(Constants.UTF8))); bw.addMutation(m); UtilWaitThread.sleep(1000); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java index 6f57f8c..ffe0a48 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterTest.java @@ -70,7 +70,7 @@ public class BloomFilterTest extends FunctionalTest { // test inserting an empty key BatchWriter bw = getConnector().createBatchWriter("bt4", new BatchWriterConfig()); Mutation m = new Mutation(new Text("")); - m.put(new Text(""), new Text(""), new Value("foo1".getBytes())); + m.put(new Text(""), new Text(""), new Value("foo1".getBytes(Constants.UTF8))); bw.addMutation(m); bw.close(); getConnector().tableOperations().flush("bt4", null, null, true); @@ -207,15 +207,15 @@ public class BloomFilterTest extends FunctionalTest { switch (depth) { case 1: m = new Mutation(new Text(key)); - m.put(new Text("cf"), new Text("cq"), new Value(("" + i).getBytes())); + m.put(new Text("cf"), new Text("cq"), new Value(Long.toString(i).getBytes(Constants.UTF8))); break; case 2: m = new Mutation(new Text("row")); - m.put(new Text(key), new Text("cq"), new Value(("" + i).getBytes())); + m.put(new Text(key), new Text("cq"), new Value(Long.toString(i).getBytes(Constants.UTF8))); break; case 3: m = new Mutation(new Text("row")); - m.put(new Text("cf"), new Text(key), new Value(("" + i).getBytes())); + m.put(new Text("cf"), new Text(key), new Value(Long.toString(i).getBytes(Constants.UTF8))); break; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java index ad4680a..90b3617 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkFileTest.java @@ -112,7 +112,7 @@ public class BulkFileTest extends FunctionalTest { private void writeData(FileSKVWriter w, int s, int e) throws Exception { for (int i = s; i <= e; i++) { - w.append(new Key(new Text(String.format("%04d", i))), new Value(("" + i).getBytes())); + w.append(new Key(new Text(String.format("%04d", i))), new Value(Integer.toString(i).getBytes(Constants.UTF8))); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java index 0cdd3b7..64db903 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkSplitOptimizationTest.java @@ -20,6 +20,7 @@ import java.util.Collections; import java.util.List; import java.util.Map; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; @@ -86,7 +87,7 @@ public class BulkSplitOptimizationTest extends FunctionalTest { String passwd = ""; if (token instanceof PasswordToken) { - passwd = new String(((PasswordToken) token).getPassword()); + passwd = new String(((PasswordToken) token).getPassword(), Constants.UTF8); } VerifyIngest.main(new String[] {"--timestamp", "1", "--size", "50", "--random", "56", "--rows", "100000", "--start", "0", "--cols", "1", "-p", passwd}); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java index 83a1b4d..cbda17d 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestReader.java @@ -24,6 +24,7 @@ import java.util.Map; import java.util.TreeMap; import java.util.UUID; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.fate.zookeeper.ZooCache; @@ -52,12 +53,12 @@ public class CacheTestReader { for (int i = 0; i < numData; i++) { byte[] v = zc.get(rootDir + "/data" + i); if (v != null) - readData.put(rootDir + "/data" + i, new String(v)); + readData.put(rootDir + "/data" + i, new String(v, Constants.UTF8)); } byte[] v = zc.get(rootDir + "/dataS"); if (v != null) - readData.put(rootDir + "/dataS", new String(v)); + readData.put(rootDir + "/dataS", new String(v, Constants.UTF8)); List children = zc.getChildren(rootDir + "/dir"); if (children != null) http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java index 0c8afe6..20ea55f 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/CacheTestWriter.java @@ -26,6 +26,7 @@ import java.util.Random; import java.util.TreeMap; import java.util.UUID; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.fate.zookeeper.IZooReaderWriter; import org.apache.accumulo.fate.zookeeper.ZooUtil.NodeExistsPolicy; @@ -83,15 +84,15 @@ public class CacheTestWriter { // change values for (int i = 0; i < numData; i++) { - byte data[] = Long.toString(r.nextLong(), 16).getBytes(); + byte data[] = Long.toString(r.nextLong(), 16).getBytes(Constants.UTF8); zk.putPersistentData(rootDir + "/data" + i, data, NodeExistsPolicy.OVERWRITE); - expectedData.put(rootDir + "/data" + i, new String(data)); + expectedData.put(rootDir + "/data" + i, new String(data, Constants.UTF8)); } // test a data node that does not always exists... if (r.nextFloat() < .5) { - byte data[] = Long.toString(r.nextLong(), 16).getBytes(); + byte data[] = Long.toString(r.nextLong(), 16).getBytes(Constants.UTF8); if (!dataSExists) { zk.putPersistentData(rootDir + "/dataS", data, NodeExistsPolicy.SKIP); @@ -100,7 +101,7 @@ public class CacheTestWriter { zk.putPersistentData(rootDir + "/dataS", data, NodeExistsPolicy.OVERWRITE); } - expectedData.put(rootDir + "/dataS", new String(data)); + expectedData.put(rootDir + "/dataS", new String(data, Constants.UTF8)); } else { if (dataSExists) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyTest.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyTest.java index c7f169e..df31ff0 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrencyTest.java @@ -90,7 +90,7 @@ public class ConcurrencyTest extends FunctionalTest { BatchWriter bw = getConnector().createBatchWriter("cct", new BatchWriterConfig()); for (int i = 0; i < 50; i++) { Mutation m = new Mutation(new Text(String.format("%06d", i))); - m.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes())); + m.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes(Constants.UTF8))); bw.addMutation(m); } @@ -107,7 +107,7 @@ public class ConcurrencyTest extends FunctionalTest { for (int i = 0; i < 50; i++) { Mutation m = new Mutation(new Text(String.format("%06d", i))); - m.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes())); + m.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes(Constants.UTF8))); bw.addMutation(m); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/ConstraintTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConstraintTest.java b/test/src/main/java/org/apache/accumulo/test/functional/ConstraintTest.java index 217fb61..a464801 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ConstraintTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ConstraintTest.java @@ -76,7 +76,7 @@ public class ConstraintTest extends FunctionalTest { BatchWriter bw = getConnector().createBatchWriter("ct", new BatchWriterConfig()); Mutation mut1 = new Mutation(new Text("r1")); - mut1.put(new Text("cf1"), new Text("cq1"), new Value("123".getBytes())); + mut1.put(new Text("cf1"), new Text("cq1"), new Value("123".getBytes(Constants.UTF8))); bw.addMutation(mut1); @@ -87,7 +87,7 @@ public class ConstraintTest extends FunctionalTest { // create a mutation with a non numeric value Mutation mut2 = new Mutation(new Text("r1")); - mut2.put(new Text("cf1"), new Text("cq1"), new Value("123a".getBytes())); + mut2.put(new Text("cf1"), new Text("cq1"), new Value("123a".getBytes(Constants.UTF8))); bw.addMutation(mut2); @@ -130,7 +130,7 @@ public class ConstraintTest extends FunctionalTest { Entry entry = iter.next(); if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1")) - || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes()))) { + || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes(Constants.UTF8)))) { throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue()); } @@ -153,7 +153,7 @@ public class ConstraintTest extends FunctionalTest { entry = iter.next(); if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1")) - || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes()))) { + || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes(Constants.UTF8)))) { throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue()); } @@ -170,7 +170,7 @@ public class ConstraintTest extends FunctionalTest { bw = getConnector().createBatchWriter("ct", new BatchWriterConfig()); Mutation mut3 = new Mutation(new Text("r1")); - mut3.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes())); + mut3.put(new Text("cf1"), new Text("cq1"), new Value("foo".getBytes(Constants.UTF8))); bw.addMutation(mut3); @@ -193,7 +193,7 @@ public class ConstraintTest extends FunctionalTest { entry = iter.next(); if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1")) - || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes()))) { + || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123a".getBytes(Constants.UTF8)))) { throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue()); } @@ -216,7 +216,7 @@ public class ConstraintTest extends FunctionalTest { entry = iter.next(); if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1")) - || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("foo".getBytes()))) { + || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("foo".getBytes(Constants.UTF8)))) { throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue()); } @@ -228,7 +228,7 @@ public class ConstraintTest extends FunctionalTest { private Mutation newMut(String row, String cf, String cq, String val) { Mutation mut1 = new Mutation(new Text(row)); - mut1.put(new Text(cf), new Text(cq), new Value(val.getBytes())); + mut1.put(new Text(cf), new Text(cq), new Value(val.getBytes(Constants.UTF8))); return mut1; } @@ -300,14 +300,14 @@ public class ConstraintTest extends FunctionalTest { Entry entry = iter.next(); if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1")) - || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes()))) { + || !entry.getKey().getColumnQualifier().equals(new Text("cq1")) || !entry.getValue().equals(new Value("123".getBytes(Constants.UTF8)))) { throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue()); } entry = iter.next(); if (!entry.getKey().getRow().equals(new Text("r1")) || !entry.getKey().getColumnFamily().equals(new Text("cf1")) - || !entry.getKey().getColumnQualifier().equals(new Text("cq4")) || !entry.getValue().equals(new Value("789".getBytes()))) { + || !entry.getKey().getColumnQualifier().equals(new Text("cq4")) || !entry.getValue().equals(new Value("789".getBytes(Constants.UTF8)))) { throw new Exception("Unexpected key or value " + entry.getKey() + " " + entry.getValue()); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseTest.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseTest.java index b48edc3..7f59afa 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseTest.java @@ -71,7 +71,7 @@ public class CreateAndUseTest extends FunctionalTest { for (int i = 1; i < 257; i++) { Mutation m = new Mutation(new Text(String.format("%08x", (i << 8) - 16))); - m.put(cf, cq, new Value(("" + i).getBytes())); + m.put(cf, cq, new Value(Integer.toString(i).getBytes(Constants.UTF8))); bw.addMutation(m); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingTest.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingTest.java index 779ecf1..49187d7 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteEverythingTest.java @@ -55,7 +55,7 @@ public class DeleteEverythingTest extends FunctionalTest { public void run() throws Exception { BatchWriter bw = getConnector().createBatchWriter("de", new BatchWriterConfig()); Mutation m = new Mutation(new Text("foo")); - m.put(new Text("bar"), new Text("1910"), new Value("5".getBytes())); + m.put(new Text("bar"), new Text("1910"), new Value("5".getBytes(Constants.UTF8))); bw.addMutation(m); bw.flush(); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitTest.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitTest.java index 2880741..78aa79a 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitTest.java @@ -46,9 +46,9 @@ public class DeleteRowsSplitTest extends FunctionalTest { static final SortedSet SPLITS = new TreeSet(); static final List ROWS = new ArrayList(); static { - for (byte b : LETTERS.getBytes()) { + for (byte b : LETTERS.getBytes(Constants.UTF8)) { SPLITS.add(new Text(new byte[] {b})); - ROWS.add(new String(new byte[] {b})); + ROWS.add(new String(new byte[] {b}, Constants.UTF8)); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java index d1f757b..9c37742 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/FunctionalTest.java @@ -290,6 +290,6 @@ public abstract class FunctionalTest { } static Mutation nm(String row, String cf, String cq, String value) { - return nm(row, cf, cq, new Value(value.getBytes())); + return nm(row, cf, cq, new Value(value.getBytes(Constants.UTF8))); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java b/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java index d329eb2..8f647e3 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/LargeRowTest.java @@ -120,7 +120,7 @@ public class LargeRowTest extends FunctionalTest { TestIngest.toPrintableChars(rowData); Mutation mut = new Mutation(new Text(rowData)); - mut.put(new Text(""), new Text(""), new Value(("" + i).getBytes())); + mut.put(new Text(""), new Text(""), new Value(Integer.toString(i).getBytes(Constants.UTF8))); bw.addMutation(mut); } @@ -168,7 +168,7 @@ public class LargeRowTest extends FunctionalTest { if (!entry.getKey().getRow().equals(new Text(rowData))) { throw new Exception("verification failed, unexpected row i =" + i); } - if (!entry.getValue().equals(Integer.toString(i).getBytes())) { + if (!entry.getValue().equals(Integer.toString(i).getBytes(Constants.UTF8))) { throw new Exception("verification failed, unexpected value i =" + i + " value = " + entry.getValue()); } count++; http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java b/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java index faecba0..d5fabd3 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/NativeMapTest.java @@ -27,6 +27,7 @@ import java.util.NoSuchElementException; import java.util.Random; import java.util.TreeMap; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.data.Key; import org.apache.accumulo.core.data.Value; import org.apache.accumulo.core.iterators.SortedKeyValueIterator; @@ -104,7 +105,7 @@ public class NativeMapTest { } private Value nv(int v) { - return new Value(String.format("r%09d", v).getBytes()); + return new Value(String.format("r%09d", v).getBytes(Constants.UTF8)); } public void setUp() { @@ -181,12 +182,12 @@ public class NativeMapTest { for (int l = 0; l < num; l++) { for (int ts = 0; ts < num; ts++) { Key key = nk(i, j, k, l, ts, true); - Value value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + true + "_" + run).getBytes()); + Value value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + true + "_" + run).getBytes(Constants.UTF8)); nm.put(key, value); key = nk(i, j, k, l, ts, false); - value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + false + "_" + run).getBytes()); + value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + false + "_" + run).getBytes(Constants.UTF8)); nm.put(key, value); } @@ -203,7 +204,7 @@ public class NativeMapTest { for (int l = 0; l < num; l++) { for (int ts = num - 1; ts >= 0; ts--) { Key key = nk(i, j, k, l, ts, true); - Value value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + true + "_" + run).getBytes()); + Value value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + true + "_" + run).getBytes(Constants.UTF8)); assertTrue(iter.hasNext()); Entry entry = iter.next(); @@ -211,7 +212,7 @@ public class NativeMapTest { assertEquals(value, entry.getValue()); key = nk(i, j, k, l, ts, false); - value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + false + "_" + run).getBytes()); + value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + false + "_" + run).getBytes(Constants.UTF8)); assertTrue(iter.hasNext()); entry = iter.next(); @@ -231,7 +232,7 @@ public class NativeMapTest { for (int l = 0; l < num; l++) { for (int ts = 0; ts < num; ts++) { Key key = nk(i, j, k, l, ts, true); - Value value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + true + "_" + run).getBytes()); + Value value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + true + "_" + run).getBytes(Constants.UTF8)); assertEquals(value, nm.get(key)); @@ -242,7 +243,7 @@ public class NativeMapTest { assertEquals(value, entry.getValue()); key = nk(i, j, k, l, ts, false); - value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + false + "_" + run).getBytes()); + value = new Value((i + "_" + j + "_" + k + "_" + l + "_" + ts + "_" + false + "_" + run).getBytes(Constants.UTF8)); assertEquals(value, nm.get(key)); @@ -362,10 +363,10 @@ public class NativeMapTest { TreeMap tm = new TreeMap(); - tm.put(new Key(new Text("fo")), new Value("0".getBytes())); - tm.put(new Key(new Text("foo")), new Value("1".getBytes())); - tm.put(new Key(new Text("foo1")), new Value("2".getBytes())); - tm.put(new Key(new Text("foo2")), new Value("3".getBytes())); + tm.put(new Key(new Text("fo")), new Value(new byte[] {'0'})); + tm.put(new Key(new Text("foo")), new Value(new byte[] {'1'})); + tm.put(new Key(new Text("foo1")), new Value(new byte[] {'2'})); + tm.put(new Key(new Text("foo2")), new Value(new byte[] {'3'})); for (Entry entry : tm.entrySet()) { nm.put(entry.getKey(), entry.getValue()); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java b/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java index a0d1825..3741a4e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/PermissionsTest.java @@ -348,7 +348,7 @@ public class PermissionsTest { // put in some initial data BatchWriter writer = getConnector().createBatchWriter(TEST_TABLE, new BatchWriterConfig()); Mutation m = new Mutation(new Text("row")); - m.put(new Text("cf"), new Text("cq"), new Value("val".getBytes())); + m.put(new Text("cf"), new Text("cq"), new Value("val".getBytes(Constants.UTF8))); writer.addMutation(m); writer.close(); @@ -386,7 +386,7 @@ public class PermissionsTest { try { writer = test_user_conn.createBatchWriter(TEST_TABLE, new BatchWriterConfig()); m = new Mutation(new Text("row")); - m.put(new Text("a"), new Text("b"), new Value("c".getBytes())); + m.put(new Text("a"), new Text("b"), new Value("c".getBytes(Constants.UTF8))); writer.addMutation(m); try { writer.close(); @@ -456,7 +456,7 @@ public class PermissionsTest { case WRITE: writer = test_user_conn.createBatchWriter(TEST_TABLE, new BatchWriterConfig()); m = new Mutation(new Text("row")); - m.put(new Text("a"), new Text("b"), new Value("c".getBytes())); + m.put(new Text("a"), new Text("b"), new Value("c".getBytes(Constants.UTF8))); writer.addMutation(m); writer.close(); break; http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java b/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java index 91ee66e..0da0f61 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/RunTests.java @@ -22,6 +22,7 @@ import java.io.InputStream; import java.util.Arrays; import java.util.List; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.Help; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; @@ -97,7 +98,7 @@ public class RunTests extends Configured implements Tool { Text result = new Text(); try { while ((len = out.read(buffer)) > 0) { - log.info("More: " + new String(buffer, 0, len)); + log.info("More: " + new String(buffer, 0, len, Constants.UTF8)); result.append(buffer, 0, len); } } catch (Exception ex) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java index 5e42525..c3c385e 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanIteratorTest.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; @@ -58,8 +59,8 @@ public class ScanIteratorTest extends FunctionalTest { for (int i = 0; i < 1000; i++) { Mutation m = new Mutation(new Text(String.format("%06d", i))); - m.put(new Text("cf1"), new Text("cq1"), new Value(("" + (1000 - i)).getBytes())); - m.put(new Text("cf1"), new Text("cq2"), new Value(("" + (i - 1000)).getBytes())); + m.put(new Text("cf1"), new Text("cq1"), new Value(Integer.toString(1000 - i).getBytes(Constants.UTF8))); + m.put(new Text("cf1"), new Text("cq2"), new Value(Integer.toString(i - 1000).getBytes(Constants.UTF8))); bw.addMutation(m); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java index f30b5a7..8554e3f 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanRangeTest.java @@ -237,7 +237,7 @@ public class ScanRangeTest extends FunctionalTest { for (int j = 0; j < CF_LIMIT; j++) { for (int k = 0; k < CQ_LIMIT; k++) { for (int t = 0; t < TS_LIMIT; t++) { - m.put(createCF(j), createCQ(k), t, new Value(String.format("%06d_%03d_%03d_%03d", i, j, k, t).getBytes())); + m.put(createCF(j), createCQ(k), t, new Value(String.format("%06d_%03d_%03d_%03d", i, j, k, t).getBytes(Constants.UTF8))); } } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java b/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java index 1551687..548e1b7 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ScanSessionTimeOutTest.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Scanner; @@ -59,7 +60,7 @@ public class ScanSessionTimeOutTest extends FunctionalTest { for (int i = 0; i < 100000; i++) { Mutation m = new Mutation(new Text(String.format("%08d", i))); for (int j = 0; j < 3; j++) - m.put(new Text("cf1"), new Text("cq" + j), new Value(("" + i + "_" + j).getBytes())); + m.put(new Text("cf1"), new Text("cq" + j), new Value((i + "_" + j).getBytes(Constants.UTF8))); bw.addMutation(m); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java b/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java index c06eebb..a644b46 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ServerSideErrorTest.java @@ -65,7 +65,7 @@ public class ServerSideErrorTest extends FunctionalTest { BatchWriter bw = getConnector().createBatchWriter("tt", new BatchWriterConfig()); Mutation m = new Mutation(new Text("r1")); - m.put(new Text("acf"), new Text("foo"), new Value("1".getBytes())); + m.put(new Text("acf"), new Text("foo"), new Value(new byte[] {'1'})); bw.addMutation(m); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java index 93bc207..1fc0e4f 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/SplitRecoveryTest.java @@ -81,7 +81,7 @@ public class SplitRecoveryTest extends FunctionalTest { public void run() throws Exception { String zPath = ZooUtil.getRoot(HdfsZooInstance.getInstance()) + "/testLock"; IZooReaderWriter zoo = ZooReaderWriter.getInstance(); - zoo.putPersistentData(zPath, "".getBytes(), NodeExistsPolicy.OVERWRITE); + zoo.putPersistentData(zPath, new byte[0], NodeExistsPolicy.OVERWRITE); ZooLock zl = new ZooLock(zPath); boolean gotLock = zl.tryLock(new LockWatcher() { @@ -95,7 +95,7 @@ public class SplitRecoveryTest extends FunctionalTest { public void unableToMonitorLockNode(Throwable e) { System.exit(-1); } - }, "foo".getBytes()); + }, "foo".getBytes(Constants.UTF8)); if (!gotLock) { System.err.println("Failed to get lock " + zPath); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java b/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java index ffe383b..8aa65e1 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/VisibilityTest.java @@ -29,6 +29,7 @@ import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; @@ -84,12 +85,12 @@ public class VisibilityTest extends FunctionalTest { } private void mput(Mutation m, String cf, String cq, String cv, String val) { - ColumnVisibility le = new ColumnVisibility(cv.getBytes()); - m.put(new Text(cf), new Text(cq), le, new Value(val.getBytes())); + ColumnVisibility le = new ColumnVisibility(cv.getBytes(Constants.UTF8)); + m.put(new Text(cf), new Text(cq), le, new Value(val.getBytes(Constants.UTF8))); } private void mputDelete(Mutation m, String cf, String cq, String cv) { - ColumnVisibility le = new ColumnVisibility(cv.getBytes()); + ColumnVisibility le = new ColumnVisibility(cv.getBytes(Constants.UTF8)); m.putDelete(new Text(cf), new Text(cq), le); } @@ -266,7 +267,7 @@ public class VisibilityTest extends FunctionalTest { private ByteArraySet nbas(Set auths) { ByteArraySet bas = new ByteArraySet(); for (String auth : auths) { - bas.add(auth.getBytes()); + bas.add(auth.getBytes(Constants.UTF8)); } return bas; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java b/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java index 2afca25..51b5054 100644 --- a/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java +++ b/test/src/main/java/org/apache/accumulo/test/functional/ZombieTServer.java @@ -131,7 +131,7 @@ public class ZombieTServer { } }; - byte[] lockContent = new ServerServices(addressString, Service.TSERV_CLIENT).toString().getBytes(); + byte[] lockContent = new ServerServices(addressString, Service.TSERV_CLIENT).toString().getBytes(Constants.UTF8); if (zlock.tryLock(lw, lockContent)) { log.debug("Obtained tablet server lock " + zlock.getLockPath()); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java index 02442fb..a9b072e 100644 --- a/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java +++ b/test/src/main/java/org/apache/accumulo/test/performance/metadata/MetadataBatchScanTest.java @@ -101,10 +101,10 @@ public class MetadataBatchScanTest { String dir = "/t-" + UUID.randomUUID(); - Constants.METADATA_DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes())); + Constants.METADATA_DIRECTORY_COLUMN.put(mut, new Value(dir.getBytes(Constants.UTF8))); for (int i = 0; i < 5; i++) { - mut.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(dir + "/00000_0000" + i + ".map"), new Value("10000,1000000".getBytes())); + mut.put(Constants.METADATA_DATAFILE_COLUMN_FAMILY, new Text(dir + "/00000_0000" + i + ".map"), new Value("10000,1000000".getBytes(Constants.UTF8))); } bw.addMutation(mut); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/randomwalk/Module.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/Module.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/Module.java index 397f2e8..fadcb66 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/Module.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/Module.java @@ -35,6 +35,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.log4j.Level; import org.w3c.dom.Document; @@ -274,9 +275,9 @@ public class Module extends Node { else if (value instanceof String || value instanceof Map || value instanceof Collection || value instanceof Number) logMsg += value; else if (value instanceof byte[]) - logMsg += new String((byte[])value); + logMsg += new String((byte[])value, Constants.UTF8); else if (value instanceof PasswordToken) - logMsg += new String(((PasswordToken) value).getPassword()); + logMsg += new String(((PasswordToken) value).getPassword(), Constants.UTF8); else logMsg += value.getClass()+ " - " + value; http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkMinusOne.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkMinusOne.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkMinusOne.java index b75b98d..14851c0 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkMinusOne.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkMinusOne.java @@ -21,7 +21,7 @@ import org.apache.accumulo.test.randomwalk.State; public class BulkMinusOne extends BulkTest { - private static final Value negOne = new Value("-1".getBytes()); + private static final Value negOne = new Value("-1".getBytes(Constants.UTF8)); @Override protected void runLater(State state) throws Exception { http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkPlusOne.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkPlusOne.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkPlusOne.java index 9135163..cdfbb36 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkPlusOne.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/BulkPlusOne.java @@ -44,7 +44,6 @@ public class BulkPlusOne extends BulkTest { public static final int COLS = 10; public static final int HEX_SIZE = (int) Math.ceil(Math.log(LOTS) / Math.log(16)); public static final String FMT = "r%0" + HEX_SIZE + "x"; - static final Value one = new Value("1".getBytes()); public static final List COLNAMES = new ArrayList(); public static final Text CHECK_COLUMN_FAMILY = new Text("cf"); static { @@ -110,7 +109,7 @@ public class BulkPlusOne extends BulkTest { @Override protected void runLater(State state) throws Exception { log.info("Incrementing"); - bulkLoadLots(log, state, one); + bulkLoadLots(log, state, ONE); } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java index cb8d2ba..b2299aa 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/bulk/Verify.java @@ -23,6 +23,7 @@ import java.util.Properties; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.cli.ClientOnRequiredTable; import org.apache.accumulo.core.client.RowIterator; import org.apache.accumulo.core.client.Scanner; @@ -35,7 +36,7 @@ import org.apache.hadoop.io.Text; public class Verify extends Test { - static byte[] zero = "0".getBytes(); + static byte[] zero = new byte[] {'0'}; @Override public void visit(State state, Properties props) throws Exception { @@ -142,7 +143,7 @@ public class Verify extends Test { * @param lastBadEntry */ private static void report(Text startBadRow, Text lastBadRow, Value value) { - System.out.println("Bad value " + new String(value.get())); + System.out.println("Bad value " + new String(value.get(), Constants.UTF8)); System.out.println(" Range [" + startBadRow + " -> " + lastBadRow + "]"); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java index f1c5e22..a2bad7c 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BatchWrite.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Properties; import java.util.Random; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; @@ -53,7 +54,7 @@ public class BatchWrite extends Test { Mutation m = new Mutation(String.format("%016x", (rand.nextLong() & 0x7fffffffffffffffl))); long val = (rand.nextLong() & 0x7fffffffffffffffl); for (int j = 0; j < 10; j++) { - m.put("cf", "cq" + j, new Value(String.format("%016x", val).getBytes())); + m.put("cf", "cq" + j, new Value(String.format("%016x", val).getBytes(Constants.UTF8))); } bw.addMutation(m); http://git-wip-us.apache.org/repos/asf/accumulo/blob/990da6ae/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java index bc0961e..d4d6838 100644 --- a/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java +++ b/test/src/main/java/org/apache/accumulo/test/randomwalk/concurrent/BulkImport.java @@ -22,6 +22,7 @@ import java.util.Properties; import java.util.Random; import java.util.TreeSet; +import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.BatchWriter; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.MutationsRejectedException; @@ -120,7 +121,7 @@ public class BulkImport extends Test { Mutation m = new Mutation(String.format("%016x", row)); long val = rand.nextLong() & 0x7fffffffffffffffl; for (int j = 0; j < 10; j++) { - m.put("cf", "cq" + j, new Value(String.format("%016x", val).getBytes())); + m.put("cf", "cq" + j, new Value(String.format("%016x", val).getBytes(Constants.UTF8))); } bw.addMutation(m);