accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1396775 - in /accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data: ./ ServerMutationTest.java
Date Wed, 10 Oct 2012 20:31:42 GMT
Author: ecn
Date: Wed Oct 10 20:31:42 2012
New Revision: 1396775

URL: http://svn.apache.org/viewvc?rev=1396775&view=rev
Log:
ACCUMULO-786: squeeze bytes out of the serialized form of Mutation

Added:
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data/
    accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data/ServerMutationTest.java
  (with props)

Added: accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data/ServerMutationTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data/ServerMutationTest.java?rev=1396775&view=auto
==============================================================================
--- accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data/ServerMutationTest.java
(added)
+++ accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data/ServerMutationTest.java
Wed Oct 10 20:31:42 2012
@@ -0,0 +1,63 @@
+package org.apache.accumulo.server.data;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.apache.accumulo.core.data.ColumnUpdate;
+import org.apache.accumulo.core.data.Value;
+import org.apache.accumulo.core.util.CachedConfiguration;
+import org.apache.hadoop.io.Text;
+import org.apache.hadoop.util.ReflectionUtils;
+import org.junit.Test;
+
+public class ServerMutationTest {
+  
+  @Test
+  public void test() throws Exception {
+    ServerMutation m = new ServerMutation(new Text("r1"));
+    m.put(new Text("cf1"), new Text("cq1"), new Value("v1".getBytes()));
+    m.put(new Text("cf2"), new Text("cq2"), 56, new Value("v2".getBytes()));
+    m.setSystemTimestamp(42);
+    
+    List<ColumnUpdate> updates = m.getUpdates();
+    
+    assertEquals(2, updates.size());
+    
+    assertEquals("r1", new String(m.getRow()));
+    ColumnUpdate cu = updates.get(0);
+    
+    assertEquals("cf1", new String(cu.getColumnFamily()));
+    assertEquals("cq1", new String(cu.getColumnQualifier()));
+    assertEquals("", new String(cu.getColumnVisibility()));
+    assertFalse(cu.hasTimestamp());
+    assertEquals(42l, cu.getTimestamp());
+    
+    ServerMutation m2 = new ServerMutation();
+    ReflectionUtils.copy(CachedConfiguration.getInstance(), m, m2);
+    
+    updates = m2.getUpdates();
+    
+    assertEquals(2, updates.size());
+    assertEquals("r1", new String(m2.getRow()));
+    
+    cu = updates.get(0);
+    assertEquals("cf1", new String(cu.getColumnFamily()));
+    assertEquals("cq1", new String(cu.getColumnQualifier()));
+    assertFalse(cu.hasTimestamp());
+    assertEquals(42l, cu.getTimestamp());
+    
+    cu = updates.get(1);
+    
+    assertEquals("r1", new String(m2.getRow()));
+    assertEquals("cf2", new String(cu.getColumnFamily()));
+    assertEquals("cq2", new String(cu.getColumnQualifier()));
+    assertTrue(cu.hasTimestamp());
+    assertEquals(56, cu.getTimestamp());
+    
+    
+  }
+  
+}

Propchange: accumulo/trunk/server/src/test/java/org/apache/accumulo/server/data/ServerMutationTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message