test and fix get_column regression. patch by Jun Rao; reviewed by jbellis for #90

git-svn-id: https://svn.apache.org/repos/asf/incubator/cassandra/trunk@766960 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Ellis 2009-04-21 02:58:49 +00:00
parent c0f5fb3bb3
commit d14f814667
2 changed files with 22 additions and 1 deletions

View File

@ -128,7 +128,7 @@ public class ReadCommand
public Row getRow(Table table) throws IOException, ColumnFamilyNotDefinedException
{
if (columnNames != EMPTY_COLUMNS)
if (!columnNames.isEmpty())
{
return table.getRow(key, columnFamilyColumn, columnNames);
}

View File

@ -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 @@ public class ReadMessageTest
}
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());
}
}