cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r766960 - in /incubator/cassandra/trunk: src/org/apache/cassandra/db/ReadCommand.java test/org/apache/cassandra/db/ReadMessageTest.java
Date Tue, 21 Apr 2009 02:58:50 GMT
Author: jbellis
Date: Tue Apr 21 02:58:49 2009
New Revision: 766960

URL: http://svn.apache.org/viewvc?rev=766960&view=rev
Log:
test and fix get_column regression.  patch by Jun Rao; reviewed by jbellis for #90

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/db/ReadCommand.java
    incubator/cassandra/trunk/test/org/apache/cassandra/db/ReadMessageTest.java

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/ReadCommand.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/ReadCommand.java?rev=766960&r1=766959&r2=766960&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/ReadCommand.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/ReadCommand.java Tue Apr 21 02:58:49
2009
@@ -128,7 +128,7 @@
 
     public Row getRow(Table table) throws IOException, ColumnFamilyNotDefinedException
     {
-        if (columnNames != EMPTY_COLUMNS)
+        if (!columnNames.isEmpty())
         {
             return table.getRow(key, columnFamilyColumn, columnNames);
         }

Modified: incubator/cassandra/trunk/test/org/apache/cassandra/db/ReadMessageTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/org/apache/cassandra/db/ReadMessageTest.java?rev=766960&r1=766959&r2=766960&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/org/apache/cassandra/db/ReadMessageTest.java (original)
+++ incubator/cassandra/trunk/test/org/apache/cassandra/db/ReadMessageTest.java Tue Apr 21
02:58:49 2009
@@ -1,7 +1,10 @@
 package org.apache.cassandra.db;
 
+import static org.testng.Assert.assertNull;
+
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Arrays;
 
 import org.apache.cassandra.io.DataInputBuffer;
 import org.apache.cassandra.io.DataOutputBuffer;
@@ -41,4 +44,22 @@
         }
         return rm2;
     }
+    
+    @Test
+    public void testGetColumn() throws IOException, ColumnFamilyNotDefinedException
+    {
+        Table table = Table.open("Table1");
+        RowMutation rm;
+
+        // add data
+        rm = new RowMutation("Table1", "key1");
+        rm.add("Standard1:Column1", "abcd".getBytes(), 0);
+        rm.apply();
+
+        ReadCommand command = new ReadCommand("Table1", "key1", "Standard1:Column1", -1,
Integer.MAX_VALUE);
+        Row row = command.getRow(table);
+        ColumnFamily cf = row.getColumnFamily("Standard1");
+        IColumn col = cf.getColumn("Column1");
+        assert Arrays.equals(((Column)col).value(), "abcd".getBytes());  
+    }
 }



Mime
View raw message