accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject accumulo git commit: ACCUMULO-2681 Remove redundant MergeInfoTest class
Date Mon, 06 Apr 2015 21:31:41 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master 670b721b9 -> 5ed504c62


ACCUMULO-2681 Remove redundant MergeInfoTest class


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/5ed504c6
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/5ed504c6
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/5ed504c6

Branch: refs/heads/master
Commit: 5ed504c62a6500def91fe8635b640ed780aa8115
Parents: 670b721
Author: Christopher Tubbs <ctubbsii@apache.org>
Authored: Mon Apr 6 17:31:11 2015 -0400
Committer: Christopher Tubbs <ctubbsii@apache.org>
Committed: Mon Apr 6 17:31:11 2015 -0400

----------------------------------------------------------------------
 .../server/master/state/MergeInfoTest.java      | 50 +++++++++++++
 .../accumulo/master/state/MergeInfoTest.java    | 76 --------------------
 2 files changed, 50 insertions(+), 76 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ed504c6/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java
----------------------------------------------------------------------
diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java
b/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java
index 7c26f85..6f8795b 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/master/state/MergeInfoTest.java
@@ -32,11 +32,14 @@ import java.io.DataInputStream;
 import java.io.DataOutputStream;
 
 import org.apache.accumulo.core.data.KeyExtent;
+import org.apache.hadoop.io.DataInputBuffer;
+import org.apache.hadoop.io.DataOutputBuffer;
 import org.apache.hadoop.io.Text;
 import org.junit.Before;
 import org.junit.Test;
 
 public class MergeInfoTest {
+
   private KeyExtent keyExtent;
   private MergeInfo mi;
 
@@ -169,4 +172,51 @@ public class MergeInfoTest {
     mi = new MergeInfo(keyExtent, MergeInfo.Operation.DELETE);
     assertTrue(mi.overlaps(keyExtent2));
   }
+
+  private static MergeInfo readWrite(MergeInfo info) throws Exception {
+    DataOutputBuffer buffer = new DataOutputBuffer();
+    info.write(buffer);
+    DataInputBuffer in = new DataInputBuffer();
+    in.reset(buffer.getData(), 0, buffer.getLength());
+    MergeInfo info2 = new MergeInfo();
+    info2.readFields(in);
+    assertEquals(info.getExtent(), info2.getExtent());
+    assertEquals(info.getState(), info2.getState());
+    assertEquals(info.getOperation(), info2.getOperation());
+    return info2;
+  }
+
+  private static KeyExtent ke(String tableId, String endRow, String prevEndRow) {
+    return new KeyExtent(new Text(tableId), endRow == null ? null : new Text(endRow), prevEndRow
== null ? null : new Text(prevEndRow));
+  }
+
+  @Test
+  public void testWritable() throws Exception {
+    MergeInfo info;
+    info = readWrite(new MergeInfo(ke("a", null, "b"), MergeInfo.Operation.MERGE));
+    info = readWrite(new MergeInfo(ke("a", "b", null), MergeInfo.Operation.MERGE));
+    info = readWrite(new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.MERGE));
+    info = readWrite(new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.DELETE));
+    assertTrue(info.isDelete());
+    info.setState(MergeState.COMPLETE);
+  }
+
+  @Test
+  public void testNeedsToBeChopped() throws Exception {
+    MergeInfo info = new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.DELETE);
+    assertTrue(info.needsToBeChopped(ke("x", "c", "b")));
+    assertTrue(info.overlaps(ke("x", "c", "b")));
+    assertFalse(info.needsToBeChopped(ke("y", "c", "b")));
+    assertFalse(info.needsToBeChopped(ke("x", "c", "bb")));
+    assertFalse(info.needsToBeChopped(ke("x", "b", "a")));
+    info = new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.MERGE);
+    assertTrue(info.needsToBeChopped(ke("x", "c", "a")));
+    assertTrue(info.needsToBeChopped(ke("x", "aa", "a")));
+    assertTrue(info.needsToBeChopped(ke("x", null, null)));
+    assertFalse(info.needsToBeChopped(ke("x", "c", "b")));
+    assertFalse(info.needsToBeChopped(ke("y", "c", "b")));
+    assertFalse(info.needsToBeChopped(ke("x", "c", "bb")));
+    assertTrue(info.needsToBeChopped(ke("x", "b", "a")));
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/5ed504c6/server/master/src/test/java/org/apache/accumulo/master/state/MergeInfoTest.java
----------------------------------------------------------------------
diff --git a/server/master/src/test/java/org/apache/accumulo/master/state/MergeInfoTest.java
b/server/master/src/test/java/org/apache/accumulo/master/state/MergeInfoTest.java
deleted file mode 100644
index 8ac3e42..0000000
--- a/server/master/src/test/java/org/apache/accumulo/master/state/MergeInfoTest.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.master.state;
-
-import org.apache.accumulo.core.data.KeyExtent;
-import org.apache.accumulo.server.master.state.MergeInfo;
-import org.apache.accumulo.server.master.state.MergeState;
-import org.apache.hadoop.io.DataInputBuffer;
-import org.apache.hadoop.io.DataOutputBuffer;
-import org.apache.hadoop.io.Text;
-import org.junit.Assert;
-import org.junit.Test;
-
-public class MergeInfoTest {
-
-  MergeInfo readWrite(MergeInfo info) throws Exception {
-    DataOutputBuffer buffer = new DataOutputBuffer();
-    info.write(buffer);
-    DataInputBuffer in = new DataInputBuffer();
-    in.reset(buffer.getData(), 0, buffer.getLength());
-    MergeInfo info2 = new MergeInfo();
-    info2.readFields(in);
-    Assert.assertEquals(info.getExtent(), info2.getExtent());
-    Assert.assertEquals(info.getState(), info2.getState());
-    Assert.assertEquals(info.getOperation(), info2.getOperation());
-    return info2;
-  }
-
-  KeyExtent ke(String tableId, String endRow, String prevEndRow) {
-    return new KeyExtent(new Text(tableId), endRow == null ? null : new Text(endRow), prevEndRow
== null ? null : new Text(prevEndRow));
-  }
-
-  @Test
-  public void testWritable() throws Exception {
-    MergeInfo info;
-    info = readWrite(new MergeInfo(ke("a", null, "b"), MergeInfo.Operation.MERGE));
-    info = readWrite(new MergeInfo(ke("a", "b", null), MergeInfo.Operation.MERGE));
-    info = readWrite(new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.MERGE));
-    info = readWrite(new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.DELETE));
-    Assert.assertTrue(info.isDelete());
-    info.setState(MergeState.COMPLETE);
-  }
-
-  @Test
-  public void testNeedsToBeChopped() throws Exception {
-    MergeInfo info = new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.DELETE);
-    Assert.assertTrue(info.needsToBeChopped(ke("x", "c", "b")));
-    Assert.assertTrue(info.overlaps(ke("x", "c", "b")));
-    Assert.assertFalse(info.needsToBeChopped(ke("y", "c", "b")));
-    Assert.assertFalse(info.needsToBeChopped(ke("x", "c", "bb")));
-    Assert.assertFalse(info.needsToBeChopped(ke("x", "b", "a")));
-    info = new MergeInfo(ke("x", "b", "a"), MergeInfo.Operation.MERGE);
-    Assert.assertTrue(info.needsToBeChopped(ke("x", "c", "a")));
-    Assert.assertTrue(info.needsToBeChopped(ke("x", "aa", "a")));
-    Assert.assertTrue(info.needsToBeChopped(ke("x", null, null)));
-    Assert.assertFalse(info.needsToBeChopped(ke("x", "c", "b")));
-    Assert.assertFalse(info.needsToBeChopped(ke("y", "c", "b")));
-    Assert.assertFalse(info.needsToBeChopped(ke("x", "c", "bb")));
-    Assert.assertTrue(info.needsToBeChopped(ke("x", "b", "a")));
-  }
-
-}


Mime
View raw message