Repository: apache/incubator-fluo
Pull request #773 (2016-09-15 18:50:27)

Fluo 770


Patch:
diff --git a/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java b/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java
index b0e61f2a..723b9c7d 100644
--- a/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java
+++ b/modules/api/src/main/java/org/apache/fluo/api/client/SnapshotBase.java
@@ -16,9 +16,14 @@
 package org.apache.fluo.api.client;
 
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.Map.Entry;
 
+import com.google.common.collect.Collections2;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Maps;
 import org.apache.fluo.api.client.scanner.ScannerBuilder;
 import org.apache.fluo.api.data.Bytes;
 import org.apache.fluo.api.data.Column;
@@ -39,17 +44,50 @@ public interface SnapshotBase {
   Bytes get(Bytes row, Column column);
 
   /**
-   * Given a row and set of {@link Column}s, retrieves a map contains the values at those
+   * Retrieves the value (in {@link Bytes}) stored at a given row and {@link Column}. Returns the
+   * passed in defaultValue if does not exist.
+   * 
+   * @param defaultValue this will be returned if row+columns does not exists
+   */
+  default Bytes get(Bytes row, Column column, Bytes defaultValue) {
+    Bytes ret = get(row, column);
+    if (ret == null) {
+      return defaultValue;
+    }
+
+    return ret;
+  }
+
+  /**
+   * Given a row and set of {@link Column}s, retrieves a map that contains the values at those
    * {@link Column}s. Only columns that exist will be returned in map.
    */
   Map<Column, Bytes> get(Bytes row, Set<Column> columns);
 
   /**
-   * Given a collection of rows and set of {@link Column}s, retrieves a map contains the values at
-   * those rows and {@link Column}s. Only rows and columns that exists will be returned in map.
+   * Given a row and list of {@link Column}s, retrieves a map that contains the values at those
+   * {@link Column}s. Only columns that exist will be returned in map.
+   */
+  default Map<Column, Bytes> get(Bytes row, Column... columns) {
+    return get(row, ImmutableSet.copyOf(columns));
+  }
+
+  /**
+   * Given a collection of rows and set of {@link Column}s, retrieves a map that contains the values
+   * at those rows and {@link Column}s. Only rows and columns that exists will be returned in map.
    */
   Map<Bytes, Map<Column, Bytes>> get(Collection<Bytes> rows, Set<Column> columns);
 
+  /**
+   * Given a collection of rows and list of {@link Column}s, retrieves a map that contains the
+   * values at those rows and {@link Column}s. Only rows and columns that exists will be returned in
+   * map.
+   */
+  default Map<Bytes, Map<Column, Bytes>> get(Collection<Bytes> rows, Column... columns) {
+    return get(rows, ImmutableSet.copyOf(columns));
+  }
+
+
   /**
    * Given a collection of {@link RowColumn}s, retrieves a map contains the values at
    * {@link RowColumn}. Only rows and columns that exists will be returned in map.
@@ -99,25 +137,77 @@ public interface SnapshotBase {
    * Wrapper for {@link #get(Collection)} that uses Strings. All strings are encoded and decoded
    * using UTF-8.
    */
-  Map<RowColumn, String> gets(Collection<RowColumn> rowColumns);
+  default Map<RowColumn, String> gets(Collection<RowColumn> rowColumns) {
+    Map<RowColumn, Bytes> bytesMap = get(rowColumns);
+    return Maps.transformValues(bytesMap, b -> b.toString());
+  }
 
   /**
    * Wrapper for {@link #get(Collection, Set)} that uses Strings. All strings are encoded and
    * decoded using UTF-8.
    */
-  Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows, Set<Column> columns);
+  default Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows,
+      Set<Column> columns) {
+    Map<Bytes, Map<Column, Bytes>> rcvs =
+        get(Collections2.transform(rows, s -> Bytes.of(s)), columns);
+    Map<String, Map<Column, String>> ret = new HashMap<>(rcvs.size());
+
+    for (Entry<Bytes, Map<Column, Bytes>> entry : rcvs.entrySet()) {
+      ret.put(entry.getKey().toString(), Maps.transformValues(entry.getValue(), b -> b.toString()));
+    }
+    return ret;
+  }
+
+  /**
+   * Wrapper for {@link #get(Collection, Set)} that uses Strings. All strings are encoded and
+   * decoded using UTF-8.
+   */
+  default Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows,
+      Column... columns) {
+    return gets(rows, ImmutableSet.copyOf(columns));
+  }
 
   /**
    * Wrapper for {@link #get(Bytes, Column)} that uses Strings. All strings are encoded and decoded
    * using UTF-8.
    */
-  String gets(CharSequence row, Column column);
+  default String gets(CharSequence row, Column column) {
+    Bytes val = get(Bytes.of(row), column);
+    if (val == null) {
+      return null;
+    }
+    return val.toString();
+  }
+
+  /**
+   * Wrapper for {@link #get(Bytes, Column, Bytes)} that uses Strings. All strings are encoded and
+   * decoded using UTF-8.
+   */
+  default String gets(CharSequence row, Column column, String defaultValue) {
+    Bytes val = get(Bytes.of(row), column);
+    if (val == null) {
+      return defaultValue;
+    }
+
+    return val.toString();
+  }
+
+  /**
+   * Wrapper for {@link #get(Bytes, Set)} that uses Strings. All strings are encoded and decoded
+   * using UTF-8.
+   */
+  default Map<Column, String> gets(CharSequence row, Set<Column> columns) {
+    Map<Column, Bytes> values = get(Bytes.of(row), columns);
+    return Maps.transformValues(values, b -> b.toString());
+  }
 
   /**
    * Wrapper for {@link #get(Bytes, Set)} that uses Strings. All strings are encoded and decoded
    * using UTF-8.
    */
-  Map<Column, String> gets(CharSequence row, Set<Column> columns);
+  default Map<Column, String> gets(CharSequence row, Column... columns) {
+    return gets(row, ImmutableSet.copyOf(columns));
+  }
 
   /**
    * @return transactions start timestamp allocated from Oracle.
diff --git a/modules/api/src/main/java/org/apache/fluo/api/client/TransactionBase.java b/modules/api/src/main/java/org/apache/fluo/api/client/TransactionBase.java
index 8167b72f..57a0e1e3 100644
--- a/modules/api/src/main/java/org/apache/fluo/api/client/TransactionBase.java
+++ b/modules/api/src/main/java/org/apache/fluo/api/client/TransactionBase.java
@@ -36,7 +36,9 @@ public interface TransactionBase extends SnapshotBase {
    * Wrapper for {@link #delete(Bytes, Column)} that uses Strings. All String are encoded using
    * UTF-8.
    */
-  void delete(CharSequence row, Column col);
+  default void delete(CharSequence row, Column col) {
+    delete(Bytes.of(row), col);
+  }
 
   /**
    * Sets a value (in {@link Bytes}) at the given row and {@link Column}
@@ -47,7 +49,9 @@ public interface TransactionBase extends SnapshotBase {
    * Wrapper for {@link #set(Bytes, Column, Bytes)} that uses Strings. All String are encoded using
    * UTF-8.
    */
-  void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException;
+  default void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException {
+    set(Bytes.of(row), col, Bytes.of(value));
+  }
 
   /**
    * Sets a weak notification at the given row and {@link Column}
@@ -58,5 +62,7 @@ public interface TransactionBase extends SnapshotBase {
    * Wrapper for {@link #setWeakNotification(Bytes, Column)} that uses Strings. All String are
    * encoded using UTF-8.
    */
-  void setWeakNotification(CharSequence row, Column col);
+  default void setWeakNotification(CharSequence row, Column col) {
+    setWeakNotification(Bytes.of(row), col);
+  }
 }
diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
index ebf06a7f..2591a57e 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/impl/TransactionImpl.java
@@ -306,11 +306,6 @@ public class TransactionImpl implements AsyncTransaction, Snapshot {
     colUpdates.put(col, value);
   }
 
-  @Override
-  public void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException {
-    set(Bytes.of(row), col, Bytes.of(value));
-  }
-
   @Override
   public void setWeakNotification(Bytes row, Column col) {
     checkIfOpen();
@@ -332,11 +327,6 @@ public class TransactionImpl implements AsyncTransaction, Snapshot {
     columns.add(col);
   }
 
-  @Override
-  public void setWeakNotification(CharSequence row, Column col) {
-    setWeakNotification(Bytes.of(row), col);
-  }
-
   @Override
   public void delete(Bytes row, Column col) throws AlreadySetException {
     checkIfOpen();
@@ -345,11 +335,6 @@ public class TransactionImpl implements AsyncTransaction, Snapshot {
     set(row, col, DELETE);
   }
 
-  @Override
-  public void delete(CharSequence row, Column col) {
-    delete(Bytes.of(row), col);
-  }
-
   private ConditionalFlutation prewrite(ConditionalFlutation cm, Bytes row, Column col, Bytes val,
       Bytes primaryRow, Column primaryColumn, boolean isTriggerRow) {
     IteratorSetting iterConf = new IteratorSetting(10, PrewriteIterator.class);
@@ -658,27 +643,6 @@ public class TransactionImpl implements AsyncTransaction, Snapshot {
     return startTs;
   }
 
-  @Override
-  public String gets(CharSequence row, Column column) {
-    return TxStringUtil.gets(this, row, column);
-  }
-
-  @Override
-  public Map<Column, String> gets(CharSequence row, Set<Column> columns) {
-    return TxStringUtil.gets(this, row, columns);
-  }
-
-  @Override
-  public Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows,
-      Set<Column> columns) {
-    return TxStringUtil.gets(this, rows, columns);
-  }
-
-  @Override
-  public Map<RowColumn, String> gets(Collection<RowColumn> rowColumns) {
-    return TxStringUtil.gets(this, rowColumns);
-  }
-
   // async experiment
 
   private abstract static class CommitCallback<V> implements FutureCallback<V> {
diff --git a/modules/core/src/main/java/org/apache/fluo/core/impl/TxStringUtil.java b/modules/core/src/main/java/org/apache/fluo/core/impl/TxStringUtil.java
deleted file mode 100644
index c9874c0b..00000000
--- a/modules/core/src/main/java/org/apache/fluo/core/impl/TxStringUtil.java
+++ /dev/null
@@ -1,64 +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.fluo.core.impl;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import com.google.common.collect.Collections2;
-import com.google.common.collect.Maps;
-import org.apache.fluo.api.client.SnapshotBase;
-import org.apache.fluo.api.data.Bytes;
-import org.apache.fluo.api.data.Column;
-import org.apache.fluo.api.data.RowColumn;
-
-public class TxStringUtil {
-  private static Map<String, Map<Column, String>> transform(Map<Bytes, Map<Column, Bytes>> rcvs) {
-    Map<String, Map<Column, String>> ret = new HashMap<>(rcvs.size());
-
-    for (Entry<Bytes, Map<Column, Bytes>> entry : rcvs.entrySet()) {
-      ret.put(entry.getKey().toString(), Maps.transformValues(entry.getValue(), b -> b.toString()));
-    }
-    return ret;
-  }
-
-  public static String gets(SnapshotBase snapshot, CharSequence row, Column column) {
-    Bytes val = snapshot.get(Bytes.of(row), column);
-    if (val == null) {
-      return null;
-    }
-    return val.toString();
-  }
-
-  public static Map<Column, String> gets(SnapshotBase snapshot, CharSequence row,
-      Set<Column> columns) {
-    Map<Column, Bytes> values = snapshot.get(Bytes.of(row), columns);
-    return Maps.transformValues(values, b -> b.toString());
-  }
-
-  public static Map<String, Map<Column, String>> gets(SnapshotBase snapshot,
-      Collection<? extends CharSequence> rows, Set<Column> columns) {
-    return transform(snapshot.get(Collections2.transform(rows, s -> Bytes.of(s)), columns));
-  }
-
-  public static Map<RowColumn, String> gets(SnapshotBase snapshot, Collection<RowColumn> rowColumns) {
-    Map<RowColumn, Bytes> bytesMap = snapshot.get(rowColumns);
-    return Maps.transformValues(bytesMap, b -> b.toString());
-  }
-}
diff --git a/modules/core/src/main/java/org/apache/fluo/core/log/TracingTransaction.java b/modules/core/src/main/java/org/apache/fluo/core/log/TracingTransaction.java
index 34cd61ed..6c52c9a2 100644
--- a/modules/core/src/main/java/org/apache/fluo/core/log/TracingTransaction.java
+++ b/modules/core/src/main/java/org/apache/fluo/core/log/TracingTransaction.java
@@ -32,7 +32,6 @@ import org.apache.fluo.core.async.AsyncCommitObserver;
 import org.apache.fluo.core.async.AsyncTransaction;
 import org.apache.fluo.core.impl.Notification;
 import org.apache.fluo.core.impl.TxStats;
-import org.apache.fluo.core.impl.TxStringUtil;
 import org.apache.fluo.core.util.Hex;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -168,11 +167,6 @@ public class TracingTransaction implements AsyncTransaction, Snapshot {
     tx.setWeakNotification(row, col);
   }
 
-  @Override
-  public void setWeakNotification(CharSequence row, Column col) {
-    setWeakNotification(Bytes.of(row), col);
-  }
-
   @Override
   public void set(Bytes row, Column col, Bytes value) throws AlreadySetException {
     if (log.isTraceEnabled()) {
@@ -181,11 +175,6 @@ public class TracingTransaction implements AsyncTransaction, Snapshot {
     tx.set(row, col, value);
   }
 
-  @Override
-  public void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException {
-    set(Bytes.of(row), col, Bytes.of(value));
-  }
-
   @Override
   public void delete(Bytes row, Column col) throws AlreadySetException {
     if (log.isTraceEnabled()) {
@@ -194,11 +183,6 @@ public class TracingTransaction implements AsyncTransaction, Snapshot {
     tx.delete(row, col);
   }
 
-  @Override
-  public void delete(CharSequence row, Column col) {
-    delete(Bytes.of(row), col);
-  }
-
   @Override
   public void commit() throws CommitException {
     try {
@@ -254,27 +238,6 @@ public class TracingTransaction implements AsyncTransaction, Snapshot {
     return tx.getStartTimestamp();
   }
 
-  @Override
-  public String gets(CharSequence row, Column column) {
-    return TxStringUtil.gets(this, row, column);
-  }
-
-  @Override
-  public Map<Column, String> gets(CharSequence row, Set<Column> columns) {
-    return TxStringUtil.gets(this, row, columns);
-  }
-
-  @Override
-  public Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows,
-      Set<Column> columns) {
-    return TxStringUtil.gets(this, rows, columns);
-  }
-
-  @Override
-  public Map<RowColumn, String> gets(Collection<RowColumn> rowColumns) {
-    return TxStringUtil.gets(this, rowColumns);
-  }
-
   public class LoggingCommitObserver implements AsyncCommitObserver {
 
     AsyncCommitObserver aco;


Test patch:
diff --git a/modules/api/src/test/java/org/apache/fluo/api/client/TestDefaultTransactionMethods.java b/modules/api/src/test/java/org/apache/fluo/api/client/TestDefaultTransactionMethods.java
new file mode 100644
index 00000000..bbe894ab
--- /dev/null
+++ b/modules/api/src/test/java/org/apache/fluo/api/client/TestDefaultTransactionMethods.java
@@ -0,0 +1,210 @@
+/*
+ * 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.fluo.api.client;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
+import org.apache.fluo.api.client.scanner.ScannerBuilder;
+import org.apache.fluo.api.data.Bytes;
+import org.apache.fluo.api.data.Column;
+import org.apache.fluo.api.data.RowColumn;
+import org.apache.fluo.api.data.RowColumnValue;
+import org.apache.fluo.api.exceptions.AlreadySetException;
+import org.apache.fluo.api.exceptions.CommitException;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestDefaultTransactionMethods {
+
+  private static class MockTransaction implements Transaction {
+
+    public Set<RowColumnValue> sets = new HashSet<>();
+    public Set<RowColumn> deletes = new HashSet<>();
+    public Set<RowColumn> weakNtfys = new HashSet<>();
+    public Map<RowColumn, Bytes> snapshot;
+
+    MockTransaction(Map<RowColumn, Bytes> snapshot) {
+      this.snapshot = snapshot;
+    }
+
+    @Override
+    public void delete(Bytes row, Column col) {
+      deletes.add(new RowColumn(row, col));
+    }
+
+    @Override
+    public void set(Bytes row, Column col, Bytes value) throws AlreadySetException {
+      sets.add(new RowColumnValue(row, col, value));
+    }
+
+    @Override
+    public void setWeakNotification(Bytes row, Column col) {
+      weakNtfys.add(new RowColumn(row, col));
+    }
+
+    @Override
+    public Bytes get(Bytes row, Column column) {
+      return snapshot.get(new RowColumn(row, column));
+    }
+
+    @Override
+    public Map<Column, Bytes> get(Bytes row, Set<Column> columns) {
+      HashMap<Column, Bytes> ret = new HashMap<Column, Bytes>();
+      for (Column column : columns) {
+        RowColumn rc = new RowColumn(row, column);
+        if (snapshot.containsKey(rc)) {
+          ret.put(column, snapshot.get(rc));
+        }
+      }
+      return ret;
+    }
+
+    @Override
+    public Map<Bytes, Map<Column, Bytes>> get(Collection<Bytes> rows, Set<Column> columns) {
+      Map<Bytes, Map<Column, Bytes>> ret = new HashMap<>();
+
+      for (Bytes row : rows) {
+        for (Column col : columns) {
+          RowColumn rc = new RowColumn(row, col);
+          if (snapshot.containsKey(rc)) {
+            ret.computeIfAbsent(row, k -> new HashMap<>()).put(col, snapshot.get(rc));
+          }
+        }
+      }
+
+      return ret;
+    }
+
+    @Override
+    public Map<RowColumn, Bytes> get(Collection<RowColumn> rowColumns) {
+      Map<RowColumn, Bytes> ret = new HashMap<>();
+      for (RowColumn rc : rowColumns) {
+        if (snapshot.containsKey(rc)) {
+          ret.put(rc, snapshot.get(rc));
+        }
+      }
+      return ret;
+    }
+
+    @Override
+    public ScannerBuilder scanner() {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public long getStartTimestamp() {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void commit() throws CommitException {
+      throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void close() {}
+
+  }
+
+  private static final Column COL1 = new Column("f1", "q1");
+  private static final Column COL2 = new Column("f1", "q2");
+
+  private Map<RowColumn, Bytes> createSnapshot() {
+    Map<RowColumn, Bytes> snap = new HashMap<>();
+    snap.put(new RowColumn("row1", COL1), Bytes.of("v1"));
+    snap.put(new RowColumn("row2", COL1), Bytes.of("v2"));
+    snap.put(new RowColumn("row2", COL2), Bytes.of("v3"));
+    snap.put(new RowColumn("row3", COL1), Bytes.of("v4"));
+    return snap;
+  }
+
+  @Test
+  public void testColumnsVarargs() {
+
+    MockTransaction tx = new MockTransaction(createSnapshot());
+    Assert
+        .assertEquals(ImmutableMap.of(COL1, Bytes.of("v1")), tx.get(Bytes.of("row1"), COL1, COL2));
+    Assert.assertEquals(ImmutableMap.of(COL1, Bytes.of("v2"), COL2, Bytes.of("v3")),
+        tx.get(Bytes.of("row2"), COL1, COL2));
+
+    Assert.assertEquals(ImmutableMap.of(COL1, "v1"), tx.gets("row1", COL1, COL2));
+    Assert.assertEquals(ImmutableMap.of(COL1, "v2", COL2, "v3"), tx.gets("row2", COL1, COL2));
+
+    Map<Bytes, Map<Column, Bytes>> ret =
+        tx.get(Arrays.asList(Bytes.of("row1"), Bytes.of("row2")), COL1, COL2);
+    Assert.assertEquals(ImmutableSet.of(Bytes.of("row1"), Bytes.of("row2")), ret.keySet());
+    Assert.assertEquals(ImmutableMap.of(COL1, Bytes.of("v1")), ret.get(Bytes.of("row1")));
+    Assert.assertEquals(ImmutableMap.of(COL1, Bytes.of("v2"), COL2, Bytes.of("v3")),
+        ret.get(Bytes.of("row2")));
+
+    Map<String, Map<Column, String>> ret2 = tx.gets(Arrays.asList("row1", "row2"), COL1, COL2);
+    Assert.assertEquals(ImmutableSet.of("row1", "row2"), ret2.keySet());
+    Assert.assertEquals(ImmutableMap.of(COL1, "v1"), ret2.get("row1"));
+    Assert.assertEquals(ImmutableMap.of(COL1, "v2", COL2, "v3"), ret2.get("row2"));
+
+    tx.close();
+  }
+
+  @Test
+  public void testGetStringMethods() {
+    MockTransaction tx = new MockTransaction(createSnapshot());
+
+    Assert.assertNull(tx.gets("row4", COL1));
+    Assert.assertEquals("v4", tx.gets("row3", COL1));
+
+    RowColumn rc1 = new RowColumn("row1", COL1);
+    RowColumn rc2 = new RowColumn("row2", COL2);
+
+    Map<RowColumn, String> ret = tx.gets(Arrays.asList(rc1, rc2));
+    Assert.assertEquals(ImmutableMap.of(rc1, "v1", rc2, "v3"), ret);
+
+    tx.close();
+  }
+
+  @Test
+  public void testMutationMethods() {
+    MockTransaction tx = new MockTransaction(createSnapshot());
+
+    tx.delete("row5", COL1);
+    tx.set("row9", COL2, "99");
+    tx.set("row8", COL2, "88");
+    tx.setWeakNotification("row5", COL2);
+
+    Assert.assertEquals(ImmutableSet.of(new RowColumn("row5", COL1)), tx.deletes);
+    Assert.assertEquals(ImmutableSet.of(new RowColumnValue("row9", COL2, "99"), new RowColumnValue(
+        "row8", COL2, "88")), tx.sets);
+    Assert.assertEquals(ImmutableSet.of(new RowColumn("row5", COL2)), tx.weakNtfys);
+
+    tx.close();
+  }
+
+  @Test
+  public void testGetDefault() {
+    MockTransaction tx = new MockTransaction(createSnapshot());
+
+    Assert.assertEquals(Bytes.of("vd"), tx.get(Bytes.of("row4"), COL1, Bytes.of("vd")));
+    Assert.assertEquals("vd", tx.gets("row4", COL1, "vd"));
+
+    tx.close();
+  }
+}
diff --git a/modules/integration/src/test/java/org/apache/fluo/integration/TestTransaction.java b/modules/integration/src/test/java/org/apache/fluo/integration/TestTransaction.java
index c4c20889..6a214c89 100644
--- a/modules/integration/src/test/java/org/apache/fluo/integration/TestTransaction.java
+++ b/modules/integration/src/test/java/org/apache/fluo/integration/TestTransaction.java
@@ -159,31 +159,16 @@ public class TestTransaction implements TransactionBase {
     tx.delete(row, col);
   }
 
-  @Override
-  public void delete(CharSequence row, Column col) {
-    tx.delete(row, col);
-  }
-
   @Override
   public void set(Bytes row, Column col, Bytes value) throws AlreadySetException {
     tx.set(row, col, value);
   }
 
-  @Override
-  public void set(CharSequence row, Column col, CharSequence value) throws AlreadySetException {
-    tx.set(row, col, value);
-  }
-
   @Override
   public void setWeakNotification(Bytes row, Column col) {
     tx.setWeakNotification(row, col);
   }
 
-  @Override
-  public void setWeakNotification(CharSequence row, Column col) {
-    tx.setWeakNotification(row, col);
-  }
-
   @Override
   public Bytes get(Bytes row, Column column) {
     return tx.get(row, column);
@@ -209,27 +194,6 @@ public class TestTransaction implements TransactionBase {
     return tx.scanner();
   }
 
-  @Override
-  public Map<RowColumn, String> gets(Collection<RowColumn> rowColumns) {
-    return tx.gets(rowColumns);
-  }
-
-  @Override
-  public Map<String, Map<Column, String>> gets(Collection<? extends CharSequence> rows,
-      Set<Column> columns) {
-    return tx.gets(rows, columns);
-  }
-
-  @Override
-  public String gets(CharSequence row, Column column) {
-    return tx.gets(row, column);
-  }
-
-  @Override
-  public Map<Column, String> gets(CharSequence row, Set<Column> columns) {
-    return tx.gets(row, columns);
-  }
-
   @Override
   public long getStartTimestamp() {
     return tx.getStartTimestamp();