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 029B81091A for ; Thu, 27 Mar 2014 16:59:14 +0000 (UTC) Received: (qmail 98243 invoked by uid 500); 27 Mar 2014 16:59:13 -0000 Delivered-To: apmail-accumulo-commits-archive@accumulo.apache.org Received: (qmail 97710 invoked by uid 500); 27 Mar 2014 16:59:10 -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 97664 invoked by uid 99); 27 Mar 2014 16:59:10 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Mar 2014 16:59:10 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CC93A8946E3; Thu, 27 Mar 2014 16:59:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: busbey@apache.org To: commits@accumulo.apache.org Date: Thu, 27 Mar 2014 16:59:09 -0000 Message-Id: <2ca9ae12625e432abb1034288d707c7f@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/6] git commit: ACCUMULO-2544: Fix match boundaries for MockTableOperations.deleteRows to be consistent with actual accumulo instance Repository: accumulo Updated Branches: refs/heads/1.5.2-SNAPSHOT 72c9af4c6 -> 7ec60f1bc refs/heads/1.6.0-SNAPSHOT 5d030cae9 -> a8572fe57 refs/heads/master 8485134d7 -> 2849cbd8e ACCUMULO-2544: Fix match boundaries for MockTableOperations.deleteRows to be consistent with actual accumulo instance Signed-off-by: Sean Busbey Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7ec60f1b Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7ec60f1b Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7ec60f1b Branch: refs/heads/1.5.2-SNAPSHOT Commit: 7ec60f1bcac4c274653d2779f1996138f3a275b7 Parents: 72c9af4 Author: Michael Fagan Authored: Tue Mar 25 14:58:37 2014 -0600 Committer: Sean Busbey Committed: Thu Mar 27 11:42:39 2014 -0500 ---------------------------------------------------------------------- .../accumulo/core/client/mock/MockTableOperations.java | 12 ++++++++---- .../core/client/mock/MockTableOperationsTest.java | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec60f1b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java index f088b1f..dc4a619 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java @@ -55,9 +55,9 @@ import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.Text; public class MockTableOperations extends TableOperationsHelper { - - final private MockAccumulo acu; - final private String username; + private static final byte[] ZERO = {0}; + private final MockAccumulo acu; + private final String username; MockTableOperations(MockAccumulo acu, String username) { this.acu = acu; @@ -314,7 +314,11 @@ public class MockTableOperations extends TableOperationsHelper { if (!exists(tableName)) throw new TableNotFoundException(tableName, tableName, ""); MockTable t = acu.tables.get(tableName); - Set keep = new TreeSet(t.table.tailMap(new Key(start)).headMap(new Key(end)).keySet()); + Text startText = new Text(start); + Text endText = new Text(end); + startText.append(ZERO, 0, 1); + endText.append(ZERO, 0, 1); + Set keep = new TreeSet(t.table.subMap(new Key(startText), new Key(endText)).keySet()); t.table.keySet().removeAll(keep); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/7ec60f1b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java index da361b0..e377884 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java @@ -267,9 +267,13 @@ public class MockTableOperationsTest { bw.flush(); to.deleteRows("test", new Text("1"), new Text("2")); Scanner s = connector.createScanner("test", Constants.NO_AUTHS); + int oneCnt = 0; for (Entry entry : s) { - Assert.assertTrue(entry.getKey().getRow().toString().charAt(0) != '1'); + char rowStart = entry.getKey().getRow().toString().charAt(0); + Assert.assertTrue(rowStart != '2'); + oneCnt += rowStart == '1' ? 1 : 0; } + Assert.assertEquals(5, oneCnt); } }