cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1026200 [9/11] - in /cassandra/trunk: ./ interface/ interface/thrift/gen-java/org/apache/cassandra/thrift/ src/java/org/apache/cassandra/auth/ src/java/org/apache/cassandra/avro/ src/java/org/apache/cassandra/cli/ src/java/org/apache/cassa...
Date Fri, 22 Oct 2010 03:23:31 GMT
Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyStoreTest.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.LinkedList;
 import java.util.List;
@@ -68,9 +69,9 @@ public class ColumnFamilyStoreTest exten
     {
         List<RowMutation> rms = new LinkedList<RowMutation>();
         RowMutation rm;
-        rm = new RowMutation("Keyspace1", "key1".getBytes());
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
-        rm.add(new QueryPath("Standard1", null, "Column2".getBytes()), "asdf".getBytes(), 0);
+        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("key1".getBytes()));
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column2".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
         rms.add(rm);
         ColumnFamilyStore store = Util.writeColumnFamily(rms);
 
@@ -78,7 +79,7 @@ public class ColumnFamilyStoreTest exten
         List<SSTableReader> ssTables = table.getAllSSTables();
         assertEquals(1, ssTables.size());
         ssTables.get(0).forceFilterFailures();
-        ColumnFamily cf = store.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("key2"), new QueryPath("Standard1", null, "Column1".getBytes())));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("key2"), new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes()))));
         assertNull(cf);
     }
 
@@ -89,7 +90,7 @@ public class ColumnFamilyStoreTest exten
         final ColumnFamilyStore store = table.getColumnFamilyStore("Standard2");
         RowMutation rm;
 
-        rm = new RowMutation("Keyspace1", "key1".getBytes());
+        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("key1".getBytes()));
         rm.delete(new QueryPath("Standard2", null, null), System.currentTimeMillis());
         rm.apply();
 
@@ -97,12 +98,12 @@ public class ColumnFamilyStoreTest exten
         {
             public void runMayThrow() throws IOException
             {
-                QueryFilter sliceFilter = QueryFilter.getSliceFilter(Util.dk("key1"), new QueryPath("Standard2", null, null), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, 1);
+                QueryFilter sliceFilter = QueryFilter.getSliceFilter(Util.dk("key1"), new QueryPath("Standard2", null, null), FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, 1);
                 ColumnFamily cf = store.getColumnFamily(sliceFilter);
                 assert cf.isMarkedForDelete();
                 assert cf.getColumnsMap().isEmpty();
 
-                QueryFilter namesFilter = QueryFilter.getNamesFilter(Util.dk("key1"), new QueryPath("Standard2", null, null), "a".getBytes());
+                QueryFilter namesFilter = QueryFilter.getNamesFilter(Util.dk("key1"), new QueryPath("Standard2", null, null), ByteBuffer.wrap("a".getBytes()));
                 cf = store.getColumnFamily(namesFilter);
                 assert cf.isMarkedForDelete();
                 assert cf.getColumnsMap().isEmpty();
@@ -118,12 +119,12 @@ public class ColumnFamilyStoreTest exten
         ColumnFamilyStore cfs = insertKey1Key2();
 
         IPartitioner p = StorageService.getPartitioner();
-        List<Row> result = cfs.getRangeSlice(ArrayUtils.EMPTY_BYTE_ARRAY,
+        List<Row> result = cfs.getRangeSlice(FBUtilities.EMPTY_BYTE_BUFFER,
                                              Util.range(p, "key1", "key2"),
                                              10,
-                                             new NamesQueryFilter("asdf".getBytes()));
+                                             new NamesQueryFilter(ByteBuffer.wrap("asdf".getBytes())));
         assertEquals(1, result.size());
-        assert Arrays.equals(result.get(0).key.key, "key2".getBytes());
+        assert result.get(0).key.key.equals(ByteBuffer.wrap("key2".getBytes()));
     }
 
     @Test
@@ -131,29 +132,29 @@ public class ColumnFamilyStoreTest exten
     {
         RowMutation rm;
 
-        rm = new RowMutation("Keyspace1", "k1".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "notbirthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), 0);
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), 0);
+        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("k1".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("notbirthdate".getBytes("UTF8"))), FBUtilities.toByteArray(1L), 0);
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(1L), 0);
         rm.apply();
 
-        rm = new RowMutation("Keyspace1", "k2".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "notbirthdate".getBytes("UTF8")), FBUtilities.toByteArray(2L), 0);
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(2L), 0);
+        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("k2".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("notbirthdate".getBytes("UTF8"))), FBUtilities.toByteArray(2L), 0);
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(2L), 0);
         rm.apply();
 
-        rm = new RowMutation("Keyspace1", "k3".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "notbirthdate".getBytes("UTF8")), FBUtilities.toByteArray(2L), 0);
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), 0);
+        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("k3".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("notbirthdate".getBytes("UTF8"))), FBUtilities.toByteArray(2L), 0);
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(1L), 0);
         rm.apply();
 
-        rm = new RowMutation("Keyspace1", "k4aaaa".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "notbirthdate".getBytes("UTF8")), FBUtilities.toByteArray(2L), 0);
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(3L), 0);
+        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("k4aaaa".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("notbirthdate".getBytes("UTF8"))), FBUtilities.toByteArray(2L), 0);
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(3L), 0);
         rm.apply();
 
         // basic single-expression query
-        IndexExpression expr = new IndexExpression("birthdate".getBytes("UTF8"), IndexOperator.EQ, FBUtilities.toByteArray(1L));
-        IndexClause clause = new IndexClause(Arrays.asList(expr), ArrayUtils.EMPTY_BYTE_ARRAY, 100);
+        IndexExpression expr = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteArray(1L));
+        IndexClause clause = new IndexClause(Arrays.asList(expr),FBUtilities.EMPTY_BYTE_BUFFER, 100);
         IFilter filter = new IdentityQueryFilter();
         IPartitioner p = StorageService.getPartitioner();
         Range range = new Range(p.getMinimumToken(), p.getMinimumToken());
@@ -161,38 +162,38 @@ public class ColumnFamilyStoreTest exten
 
         assert rows != null;
         assert rows.size() == 2 : StringUtils.join(rows, ",");
-        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key);
-        assert Arrays.equals("k3".getBytes(), rows.get(1).key.key);
-        assert Arrays.equals(FBUtilities.toByteArray(1L), rows.get(0).cf.getColumn("birthdate".getBytes("UTF8")).value());
-        assert Arrays.equals(FBUtilities.toByteArray(1L), rows.get(1).cf.getColumn("birthdate".getBytes("UTF8")).value());
+        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key.array());
+        assert Arrays.equals("k3".getBytes(), rows.get(1).key.key.array());
+        assert FBUtilities.toByteArray(1L).equals( rows.get(0).cf.getColumn(ByteBuffer.wrap("birthdate".getBytes("UTF8"))).value());
+        assert FBUtilities.toByteArray(1L).equals( rows.get(1).cf.getColumn(ByteBuffer.wrap("birthdate".getBytes("UTF8"))).value());
 
         // add a second expression
-        IndexExpression expr2 = new IndexExpression("notbirthdate".getBytes("UTF8"), IndexOperator.GTE, FBUtilities.toByteArray(2L));
-        clause = new IndexClause(Arrays.asList(expr, expr2), ArrayUtils.EMPTY_BYTE_ARRAY, 100);
+        IndexExpression expr2 = new IndexExpression(ByteBuffer.wrap("notbirthdate".getBytes("UTF8")), IndexOperator.GTE, FBUtilities.toByteArray(2L));
+        clause = new IndexClause(Arrays.asList(expr, expr2), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").scan(clause, range, filter);
 
         assert rows.size() == 1 : StringUtils.join(rows, ",");
-        assert Arrays.equals("k3".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k3".getBytes(), rows.get(0).key.key.array());
 
         // same query again, but with resultset not including the subordinate expression
-        rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").scan(clause, range, new NamesQueryFilter("birthdate".getBytes("UTF8")));
+        rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").scan(clause, range, new NamesQueryFilter(ByteBuffer.wrap("birthdate".getBytes("UTF8"))));
 
         assert rows.size() == 1 : StringUtils.join(rows, ",");
-        assert Arrays.equals("k3".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k3".getBytes(), rows.get(0).key.key.array());
         assert rows.get(0).cf.getColumnCount() == 1 : rows.get(0).cf;
 
         // once more, this time with a slice rowset that needs to be expanded
-        SliceQueryFilter emptyFilter = new SliceQueryFilter(ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, false, 0);
+        SliceQueryFilter emptyFilter = new SliceQueryFilter(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, 0);
         rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").scan(clause, range, emptyFilter);
-
+      
         assert rows.size() == 1 : StringUtils.join(rows, ",");
-        assert Arrays.equals("k3".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k3".getBytes(), rows.get(0).key.key.array());
         assert rows.get(0).cf.getColumnCount() == 0;
 
         // query with index hit but rejected by secondary clause, with a small enough count that just checking count
         // doesn't tell the scan loop that it's done
-        IndexExpression expr3 = new IndexExpression("notbirthdate".getBytes("UTF8"), IndexOperator.EQ, FBUtilities.toByteArray(-1L));
-        clause = new IndexClause(Arrays.asList(expr, expr3), ArrayUtils.EMPTY_BYTE_ARRAY, 1);
+        IndexExpression expr3 = new IndexExpression(ByteBuffer.wrap("notbirthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteArray(-1L));
+        clause = new IndexClause(Arrays.asList(expr, expr3), FBUtilities.EMPTY_BYTE_BUFFER, 1);
         rows = Table.open("Keyspace1").getColumnFamilyStore("Indexed1").scan(clause, range, filter);
 
         assert rows.isEmpty();
@@ -204,43 +205,43 @@ public class ColumnFamilyStoreTest exten
         ColumnFamilyStore cfs = Table.open("Keyspace3").getColumnFamilyStore("Indexed1");
         RowMutation rm;
 
-        rm = new RowMutation("Keyspace3", "k1".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), 0);
+        rm = new RowMutation("Keyspace3", ByteBuffer.wrap("k1".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(1L), 0);
         rm.apply();
 
-        IndexExpression expr = new IndexExpression("birthdate".getBytes("UTF8"), IndexOperator.EQ, FBUtilities.toByteArray(1L));
-        IndexClause clause = new IndexClause(Arrays.asList(expr), ArrayUtils.EMPTY_BYTE_ARRAY, 100);
+        IndexExpression expr = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteArray(1L));
+        IndexClause clause = new IndexClause(Arrays.asList(expr), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         IFilter filter = new IdentityQueryFilter();
         IPartitioner p = StorageService.getPartitioner();
         Range range = new Range(p.getMinimumToken(), p.getMinimumToken());
         List<Row> rows = cfs.scan(clause, range, filter);
         assert rows.size() == 1 : StringUtils.join(rows, ",");
-        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key.array());
 
         // delete the column directly
-        rm = new RowMutation("Keyspace3", "k1".getBytes());
-        rm.delete(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), 1);
+        rm = new RowMutation("Keyspace3", ByteBuffer.wrap("k1".getBytes()));
+        rm.delete(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), 1);
         rm.apply();
         rows = cfs.scan(clause, range, filter);
         assert rows.isEmpty();
 
         // verify that it's not being indexed under the deletion column value either
         IColumn deletion = rm.getColumnFamilies().iterator().next().iterator().next();
-        IndexExpression expr0 = new IndexExpression("birthdate".getBytes("UTF8"), IndexOperator.EQ, deletion.value());
-        IndexClause clause0 = new IndexClause(Arrays.asList(expr0), ArrayUtils.EMPTY_BYTE_ARRAY, 100);
+        IndexExpression expr0 = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, deletion.value());
+        IndexClause clause0 = new IndexClause(Arrays.asList(expr0), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         rows = cfs.scan(clause0, range, filter);
         assert rows.isEmpty();
 
         // resurrect w/ a newer timestamp
-        rm = new RowMutation("Keyspace3", "k1".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), 2);
+        rm = new RowMutation("Keyspace3", ByteBuffer.wrap("k1".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(1L), 2);
         rm.apply();
         rows = cfs.scan(clause, range, filter);
         assert rows.size() == 1 : StringUtils.join(rows, ",");
-        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key.array());
 
         // delete the entire row
-        rm = new RowMutation("Keyspace3", "k1".getBytes());
+        rm = new RowMutation("Keyspace3", ByteBuffer.wrap("k1".getBytes()));
         rm.delete(new QueryPath("Indexed1"), 3);
         rm.apply();
         rows = cfs.scan(clause, range, filter);
@@ -254,33 +255,33 @@ public class ColumnFamilyStoreTest exten
 
         // create a row and update the birthdate value, test that the index query fetches the new version
         RowMutation rm;
-        rm = new RowMutation("Keyspace2", "k1".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), 1);
+        rm = new RowMutation("Keyspace2", ByteBuffer.wrap("k1".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(1L), 1);
         rm.apply();
-        rm = new RowMutation("Keyspace2", "k1".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(2L), 2);
+        rm = new RowMutation("Keyspace2", ByteBuffer.wrap("k1".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(2L), 2);
         rm.apply();
 
-        IndexExpression expr = new IndexExpression("birthdate".getBytes("UTF8"), IndexOperator.EQ, FBUtilities.toByteArray(1L));
-        IndexClause clause = new IndexClause(Arrays.asList(expr), ArrayUtils.EMPTY_BYTE_ARRAY, 100);
+        IndexExpression expr = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteArray(1L));
+        IndexClause clause = new IndexClause(Arrays.asList(expr), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         IFilter filter = new IdentityQueryFilter();
         IPartitioner p = StorageService.getPartitioner();
         Range range = new Range(p.getMinimumToken(), p.getMinimumToken());
         List<Row> rows = table.getColumnFamilyStore("Indexed1").scan(clause, range, filter);
         assert rows.size() == 0;
 
-        expr = new IndexExpression("birthdate".getBytes("UTF8"), IndexOperator.EQ, FBUtilities.toByteArray(2L));
-        clause = new IndexClause(Arrays.asList(expr), ArrayUtils.EMPTY_BYTE_ARRAY, 100);
+        expr = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteArray(2L));
+        clause = new IndexClause(Arrays.asList(expr), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         rows = table.getColumnFamilyStore("Indexed1").scan(clause, range, filter);
-        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key.array());
 
         // update the birthdate value with an OLDER timestamp, and test that the index ignores this
-        rm = new RowMutation("Keyspace2", "k1".getBytes());
-        rm.add(new QueryPath("Indexed1", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(3L), 0);
+        rm = new RowMutation("Keyspace2", ByteBuffer.wrap("k1".getBytes()));
+        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(3L), 0);
         rm.apply();
 
         rows = table.getColumnFamilyStore("Indexed1").scan(clause, range, filter);
-        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key.array());
     }
 
     @Test
@@ -290,38 +291,38 @@ public class ColumnFamilyStoreTest exten
 
         // create a row and update the birthdate value, test that the index query fetches the new version
         RowMutation rm;
-        rm = new RowMutation("Keyspace1", "k1".getBytes());
-        rm.add(new QueryPath("Indexed2", null, "birthdate".getBytes("UTF8")), FBUtilities.toByteArray(1L), 1);
+        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("k1".getBytes()));
+        rm.add(new QueryPath("Indexed2", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteArray(1L), 1);
         rm.apply();
 
         ColumnFamilyStore cfs = table.getColumnFamilyStore("Indexed2");
-        ColumnDefinition old = cfs.metadata.column_metadata.get("birthdate".getBytes("UTF8"));
+        ColumnDefinition old = cfs.metadata.column_metadata.get(ByteBuffer.wrap("birthdate".getBytes("UTF8")));
         ColumnDefinition cd = new ColumnDefinition(old.name, old.validator.getClass().getName(), IndexType.KEYS, "birthdate_index");
         cfs.addIndex(cd);
-        while (!SystemTable.isIndexBuilt("Keyspace1", cfs.getIndexedColumnFamilyStore("birthdate".getBytes("UTF8")).columnFamily))
+        while (!SystemTable.isIndexBuilt("Keyspace1", cfs.getIndexedColumnFamilyStore(ByteBuffer.wrap("birthdate".getBytes("UTF8"))).columnFamily))
             TimeUnit.MILLISECONDS.sleep(100);
 
-        IndexExpression expr = new IndexExpression("birthdate".getBytes("UTF8"), IndexOperator.EQ, FBUtilities.toByteArray(1L));
-        IndexClause clause = new IndexClause(Arrays.asList(expr), ArrayUtils.EMPTY_BYTE_ARRAY, 100);
+        IndexExpression expr = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteArray(1L));
+        IndexClause clause = new IndexClause(Arrays.asList(expr), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         IFilter filter = new IdentityQueryFilter();
         IPartitioner p = StorageService.getPartitioner();
         Range range = new Range(p.getMinimumToken(), p.getMinimumToken());
         List<Row> rows = table.getColumnFamilyStore("Indexed2").scan(clause, range, filter);
         assert rows.size() == 1 : StringUtils.join(rows, ",");
-        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key);
+        assert Arrays.equals("k1".getBytes(), rows.get(0).key.key.array());
     }
 
     private ColumnFamilyStore insertKey1Key2() throws IOException, ExecutionException, InterruptedException
     {
         List<RowMutation> rms = new LinkedList<RowMutation>();
         RowMutation rm;
-        rm = new RowMutation("Keyspace2", "key1".getBytes());
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
+        rm = new RowMutation("Keyspace2", ByteBuffer.wrap("key1".getBytes()));
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
         rms.add(rm);
         Util.writeColumnFamily(rms);
 
-        rm = new RowMutation("Keyspace2", "key2".getBytes());
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
+        rm = new RowMutation("Keyspace2", ByteBuffer.wrap("key2".getBytes()));
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
         rms.add(rm);
         return Util.writeColumnFamily(rms);
     }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/ColumnFamilyTest.java Fri Oct 22 03:23:26 2010
@@ -21,6 +21,7 @@ package org.apache.cassandra.db;
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.Arrays;
 import java.util.TreeMap;
 
@@ -77,7 +78,7 @@ public class ColumnFamilyTest extends Sc
         cf = ColumnFamily.serializer().deserialize(new DataInputStream(bufIn));
         for (String cName : map.navigableKeySet())
         {
-            assert new String(cf.getColumn(cName.getBytes()).value()).equals(map.get(cName));
+            assert new String(cf.getColumn(ByteBuffer.wrap(cName.getBytes())).value().array()).equals(map.get(cName));
         }
         assert cf.getColumnNames().size() == map.size();
     }
@@ -104,7 +105,7 @@ public class ColumnFamilyTest extends Sc
         cf.addColumn(column("col1", "val2", 2)); // same timestamp, new value
         cf.addColumn(column("col1", "val3", 1)); // older timestamp -- should be ignored
 
-        assert Arrays.equals("val2".getBytes(), cf.getColumn("col1".getBytes()).value());
+        assert Arrays.equals("val2".getBytes(), cf.getColumn(ByteBuffer.wrap("col1".getBytes())).value().array());
     }
 
     @Test
@@ -113,33 +114,33 @@ public class ColumnFamilyTest extends Sc
         ColumnFamily cf_new = ColumnFamily.create("Keyspace1", "Standard1");
         ColumnFamily cf_old = ColumnFamily.create("Keyspace1", "Standard1");
         ColumnFamily cf_result = ColumnFamily.create("Keyspace1", "Standard1");
-        byte val[] = "sample value".getBytes();
-        byte val2[] = "x value ".getBytes();
+        ByteBuffer val = ByteBuffer.wrap("sample value".getBytes());
+        ByteBuffer val2 = ByteBuffer.wrap("x value ".getBytes());
 
         // exercise addColumn(QueryPath, ...)
-        cf_new.addColumn(QueryPath.column("col1".getBytes()), val, 3);
-        cf_new.addColumn(QueryPath.column("col2".getBytes()), val, 4);
+        cf_new.addColumn(QueryPath.column(ByteBuffer.wrap("col1".getBytes())), val, 3);
+        cf_new.addColumn(QueryPath.column(ByteBuffer.wrap("col2".getBytes())), val, 4);
 
-        cf_old.addColumn(QueryPath.column("col2".getBytes()), val2, 1);
-        cf_old.addColumn(QueryPath.column("col3".getBytes()), val2, 2);
+        cf_old.addColumn(QueryPath.column(ByteBuffer.wrap("col2".getBytes())), val2, 1);
+        cf_old.addColumn(QueryPath.column(ByteBuffer.wrap("col3".getBytes())), val2, 2);
 
         cf_result.addAll(cf_new);
         cf_result.addAll(cf_old);
 
         assert 3 == cf_result.getColumnCount() : "Count is " + cf_new.getColumnCount();
         //addcolumns will only add if timestamp >= old timestamp
-        assert Arrays.equals(val, cf_result.getColumn("col2".getBytes()).value());
+        assert val.equals(cf_result.getColumn(ByteBuffer.wrap("col2".getBytes())).value());
 
         // check that tombstone wins timestamp ties
-        cf_result.addTombstone("col1".getBytes(), 0, 3);
-        assert cf_result.getColumn("col1".getBytes()).isMarkedForDelete();
-        cf_result.addColumn(QueryPath.column("col1".getBytes()), val2, 3);
-        assert cf_result.getColumn("col1".getBytes()).isMarkedForDelete();
+        cf_result.addTombstone(ByteBuffer.wrap("col1".getBytes()), 0, 3);
+        assert cf_result.getColumn(ByteBuffer.wrap("col1".getBytes())).isMarkedForDelete();
+        cf_result.addColumn(QueryPath.column(ByteBuffer.wrap("col1".getBytes())), val2, 3);
+        assert cf_result.getColumn(ByteBuffer.wrap("col1".getBytes())).isMarkedForDelete();
 
         // check that column value wins timestamp ties in absence of tombstone
-        cf_result.addColumn(QueryPath.column("col3".getBytes()), val, 2);
-        assert Arrays.equals(cf_result.getColumn("col3".getBytes()).value(), val2);
-        cf_result.addColumn(QueryPath.column("col3".getBytes()), "z".getBytes(), 2);
-        assert Arrays.equals(cf_result.getColumn("col3".getBytes()).value(), "z".getBytes());
+        cf_result.addColumn(QueryPath.column(ByteBuffer.wrap("col3".getBytes())), val, 2);
+        assert cf_result.getColumn(ByteBuffer.wrap("col3".getBytes())).value().equals(val2);
+        cf_result.addColumn(QueryPath.column(ByteBuffer.wrap("col3".getBytes())), ByteBuffer.wrap("z".getBytes()), 2);
+        assert cf_result.getColumn(ByteBuffer.wrap("col3".getBytes())).value().equals(ByteBuffer.wrap("z".getBytes()));
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsPurgeTest.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.Collection;
 import java.util.concurrent.ExecutionException;
 
@@ -29,6 +30,7 @@ import org.apache.cassandra.config.Datab
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.io.sstable.SSTableReader;
+import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.Util;
 
 import static junit.framework.Assert.assertEquals;
@@ -55,7 +57,7 @@ public class CompactionsPurgeTest extend
         rm = new RowMutation(TABLE1, key.key);
         for (int i = 0; i < 10; i++)
         {
-            rm.add(new QueryPath(cfName, null, String.valueOf(i).getBytes()), new byte[0], 0);
+            rm.add(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(i).getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         }
         rm.apply();
         cfs.forceBlockingFlush();
@@ -64,14 +66,14 @@ public class CompactionsPurgeTest extend
         for (int i = 0; i < 10; i++)
         {
             rm = new RowMutation(TABLE1, key.key);
-            rm.delete(new QueryPath(cfName, null, String.valueOf(i).getBytes()), 1);
+            rm.delete(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(i).getBytes())), 1);
             rm.apply();
         }
         cfs.forceBlockingFlush();
 
         // resurrect one column
         rm = new RowMutation(TABLE1, key.key);
-        rm.add(new QueryPath(cfName, null, String.valueOf(5).getBytes()), new byte[0], 2);
+        rm.add(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(5).getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 2);
         rm.apply();
         cfs.forceBlockingFlush();
 
@@ -80,7 +82,7 @@ public class CompactionsPurgeTest extend
         cfs.invalidateCachedRow(key);
         ColumnFamily cf = cfs.getColumnFamily(QueryFilter.getIdentityFilter(key, new QueryPath(cfName)));
         assertColumns(cf, "5");
-        assert cf.getColumn(String.valueOf(5).getBytes()) != null;
+        assert cf.getColumn(ByteBuffer.wrap(String.valueOf(5).getBytes())) != null;
     }
 
     @Test
@@ -100,7 +102,7 @@ public class CompactionsPurgeTest extend
             rm = new RowMutation(TABLE2, key.key);
             for (int i = 0; i < 10; i++)
             {
-                rm.add(new QueryPath(cfName, null, String.valueOf(i).getBytes()), new byte[0], 0);
+                rm.add(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(i).getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
             }
             rm.apply();
             cfs.forceBlockingFlush();
@@ -109,7 +111,7 @@ public class CompactionsPurgeTest extend
             for (int i = 0; i < 10; i++)
             {
                 rm = new RowMutation(TABLE2, key.key);
-                rm.delete(new QueryPath(cfName, null, String.valueOf(i).getBytes()), 1);
+                rm.delete(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(i).getBytes())), 1);
                 rm.apply();
             }
             cfs.forceBlockingFlush();
@@ -123,7 +125,7 @@ public class CompactionsPurgeTest extend
         cfs.forceBlockingFlush();
         Collection<SSTableReader> sstablesIncomplete = cfs.getSSTables();
         rm = new RowMutation(TABLE2, key1.key);
-        rm.add(new QueryPath(cfName, null, String.valueOf(5).getBytes()), new byte[0], 2);
+        rm.add(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(5).getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 2);
         rm.apply();
         cfs.forceBlockingFlush();
         CompactionManager.instance.doCompaction(cfs, sstablesIncomplete, Integer.MAX_VALUE);
@@ -155,7 +157,7 @@ public class CompactionsPurgeTest extend
         rm = new RowMutation(TABLE1, key.key);
         for (int i = 0; i < 5; i++)
         {
-            rm.add(new QueryPath(cfName, null, String.valueOf(i).getBytes()), new byte[0], 0);
+            rm.add(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(i).getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         }
         rm.apply();
 
@@ -163,7 +165,7 @@ public class CompactionsPurgeTest extend
         for (int i = 0; i < 5; i++)
         {
             rm = new RowMutation(TABLE1, key.key);
-            rm.delete(new QueryPath(cfName, null, String.valueOf(i).getBytes()), 1);
+            rm.delete(new QueryPath(cfName, null, ByteBuffer.wrap(String.valueOf(i).getBytes())), 1);
             rm.apply();
         }
         store.forceBlockingFlush();
@@ -207,18 +209,18 @@ public class CompactionsPurgeTest extend
 
         // inserts
         rm = new RowMutation(TABLE1, key1.key);
-        rm.add(new QueryPath(cfName, null, "1".getBytes()), new byte[0], 0);
+        rm.add(new QueryPath(cfName, null, ByteBuffer.wrap("1".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         rm.apply();
         rm = new RowMutation(TABLE1, key2.key);
-        rm.add(new QueryPath(cfName, null, "2".getBytes()), new byte[0], 0);
+        rm.add(new QueryPath(cfName, null, ByteBuffer.wrap("2".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         rm.apply();
 
         // deletes
         rm = new RowMutation(TABLE1, key1.key);
-        rm.delete(new QueryPath(cfName, null, "1".getBytes()), 1);
+        rm.delete(new QueryPath(cfName, null, ByteBuffer.wrap("1".getBytes())), 1);
         rm.apply();
         rm = new RowMutation(TABLE1, key2.key);
-        rm.delete(new QueryPath(cfName, null, "2".getBytes()), 1);
+        rm.delete(new QueryPath(cfName, null, ByteBuffer.wrap("2".getBytes())), 1);
         rm.apply();
 
         // After a flush, the cache should expand to be X% of indices * INDEX_INTERVAL.

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/CompactionsTest.java Fri Oct 22 03:23:26 2010
@@ -20,6 +20,7 @@ package org.apache.cassandra.db;
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.List;
@@ -60,7 +61,7 @@ public class CompactionsTest extends Cle
             for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
                 DecoratedKey key = Util.dk(String.valueOf(i % 2));
                 RowMutation rm = new RowMutation(TABLE1, key.key);
-                rm.add(new QueryPath("Standard1", null, String.valueOf(i / 2).getBytes()), new byte[0], j * ROWS_PER_SSTABLE + i);
+                rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap(String.valueOf(i / 2).getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, j * ROWS_PER_SSTABLE + i);
                 rm.apply();
                 inserted.add(key);
             }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/DefsTest.java Fri Oct 22 03:23:26 2010
@@ -20,6 +20,7 @@ package org.apache.cassandra.db;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.*;
 import java.util.concurrent.ExecutionException;
 
@@ -148,9 +149,9 @@ public class DefsTest extends CleanupHel
         assert m3.getClass().equals(reconstituded[2].getClass());
         
         // verify that the row mutations are the same. rather than exposing the private fields, serialize and verify.
-        assert Arrays.equals(m1.serialize(), reconstituded[0].serialize());
-        assert Arrays.equals(m2.serialize(), reconstituded[1].serialize());
-        assert Arrays.equals(m3.serialize(), reconstituded[2].serialize());
+        assert m1.serialize().equals(reconstituded[0].serialize());
+        assert m2.serialize().equals(reconstituded[1].serialize());
+        assert m3.serialize().equals(reconstituded[2].serialize());
     }
 
     @Test
@@ -171,16 +172,16 @@ public class DefsTest extends CleanupHel
         // now read and write to it.
         DecoratedKey dk = Util.dk("key0");
         RowMutation rm = new RowMutation(ks, dk.key);
-        rm.add(new QueryPath(cf, null, "col0".getBytes()), "value0".getBytes(), 1L);
+        rm.add(new QueryPath(cf, null, ByteBuffer.wrap("col0".getBytes())), ByteBuffer.wrap("value0".getBytes()), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(ks).getColumnFamilyStore(cf);
         assert store != null;
         store.forceBlockingFlush();
         
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cf), "col0".getBytes()));
-        assert cfam.getColumn("col0".getBytes()) != null;
-        IColumn col = cfam.getColumn("col0".getBytes());
-        assert Arrays.equals("value0".getBytes(), col.value());
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cf), ByteBuffer.wrap("col0".getBytes())));
+        assert cfam.getColumn(ByteBuffer.wrap("col0".getBytes())) != null;
+        IColumn col = cfam.getColumn(ByteBuffer.wrap("col0".getBytes()));
+        assert ByteBuffer.wrap("value0".getBytes()).equals(col.value());
     }
 
     @Test
@@ -196,7 +197,7 @@ public class DefsTest extends CleanupHel
         // write some data, force a flush, then verify that files exist on disk.
         RowMutation rm = new RowMutation(ks.name, dk.key);
         for (int i = 0; i < 100; i++)
-            rm.add(new QueryPath(cfm.cfName, null, ("col" + i).getBytes()), "anyvalue".getBytes(), 1L);
+            rm.add(new QueryPath(cfm.cfName, null, ByteBuffer.wrap(("col" + i).getBytes())), ByteBuffer.wrap("anyvalue".getBytes()), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(cfm.tableName).getColumnFamilyStore(cfm.cfName);
         assert store != null;
@@ -213,7 +214,7 @@ public class DefsTest extends CleanupHel
         boolean success = true;
         try
         {
-            rm.add(new QueryPath("Standard1", null, "col0".getBytes()), "value0".getBytes(), 1L);
+            rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("col0".getBytes())), ByteBuffer.wrap("value0".getBytes()), 1L);
             rm.apply();
         }
         catch (Throwable th)
@@ -242,7 +243,7 @@ public class DefsTest extends CleanupHel
         // write some data, force a flush, then verify that files exist on disk.
         RowMutation rm = new RowMutation(ks.name, dk.key);
         for (int i = 0; i < 100; i++)
-            rm.add(new QueryPath(oldCfm.cfName, null, ("col" + i).getBytes()), "anyvalue".getBytes(), 1L);
+            rm.add(new QueryPath(oldCfm.cfName, null, ByteBuffer.wrap(("col" + i).getBytes())), ByteBuffer.wrap("anyvalue".getBytes()), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(oldCfm.tableName).getColumnFamilyStore(oldCfm.cfName);
         assert store != null;
@@ -262,18 +263,18 @@ public class DefsTest extends CleanupHel
         // do some reads.
         store = Table.open(oldCfm.tableName).getColumnFamilyStore(cfName);
         assert store != null;
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getSliceFilter(dk, new QueryPath(cfName), "".getBytes(), "".getBytes(), false, 1000));
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getSliceFilter(dk, new QueryPath(cfName), FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, 1000));
         assert cfam.getSortedColumns().size() == 100; // should be good enough?
         
         // do some writes
         rm = new RowMutation(ks.name, dk.key);
-        rm.add(new QueryPath(cfName, null, "col5".getBytes()), "updated".getBytes(), 2L);
+        rm.add(new QueryPath(cfName, null, ByteBuffer.wrap("col5".getBytes())), ByteBuffer.wrap("updated".getBytes()), 2L);
         rm.apply();
         store.forceBlockingFlush();
         
-        cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cfName), "col5".getBytes()));
+        cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cfName), ByteBuffer.wrap("col5".getBytes())));
         assert cfam.getColumnCount() == 1;
-        assert Arrays.equals(cfam.getColumn("col5".getBytes()).value(), "updated".getBytes());
+        assert cfam.getColumn(ByteBuffer.wrap("col5".getBytes())).value().equals( ByteBuffer.wrap("updated".getBytes()));
     }
     
     @Test
@@ -291,16 +292,16 @@ public class DefsTest extends CleanupHel
 
         // test reads and writes.
         RowMutation rm = new RowMutation(newCf.tableName, dk.key);
-        rm.add(new QueryPath(newCf.cfName, null, "col0".getBytes()), "value0".getBytes(), 1L);
+        rm.add(new QueryPath(newCf.cfName, null, ByteBuffer.wrap("col0".getBytes())), ByteBuffer.wrap("value0".getBytes()), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(newCf.tableName).getColumnFamilyStore(newCf.cfName);
         assert store != null;
         store.forceBlockingFlush();
         
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(newCf.cfName), "col0".getBytes()));
-        assert cfam.getColumn("col0".getBytes()) != null;
-        IColumn col = cfam.getColumn("col0".getBytes());
-        assert Arrays.equals("value0".getBytes(), col.value());
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(newCf.cfName), ByteBuffer.wrap("col0".getBytes())));
+        assert cfam.getColumn(ByteBuffer.wrap("col0".getBytes())) != null;
+        IColumn col = cfam.getColumn(ByteBuffer.wrap("col0".getBytes()));
+        assert ByteBuffer.wrap("value0".getBytes()).equals(col.value());
     }
     
     @Test
@@ -316,7 +317,7 @@ public class DefsTest extends CleanupHel
         // write some data, force a flush, then verify that files exist on disk.
         RowMutation rm = new RowMutation(ks.name, dk.key);
         for (int i = 0; i < 100; i++)
-            rm.add(new QueryPath(cfm.cfName, null, ("col" + i).getBytes()), "anyvalue".getBytes(), 1L);
+            rm.add(new QueryPath(cfm.cfName, null, ByteBuffer.wrap(("col" + i).getBytes())), ByteBuffer.wrap("anyvalue".getBytes()), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(cfm.tableName).getColumnFamilyStore(cfm.cfName);
         assert store != null;
@@ -332,7 +333,7 @@ public class DefsTest extends CleanupHel
         boolean success = true;
         try
         {
-            rm.add(new QueryPath("Standard1", null, "col0".getBytes()), "value0".getBytes(), 1L);
+            rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("col0".getBytes())), ByteBuffer.wrap("value0".getBytes()), 1L);
             rm.apply();
         }
         catch (Throwable th)
@@ -366,7 +367,7 @@ public class DefsTest extends CleanupHel
         // write some data that we hope to read back later.
         RowMutation rm = new RowMutation(oldKs.name, dk.key);
         for (int i = 0; i < 10; i++)
-            rm.add(new QueryPath(cfName, null, ("col" + i).getBytes()), "value".getBytes(), 1L);
+            rm.add(new QueryPath(cfName, null, ByteBuffer.wrap(("col" + i).getBytes())), ByteBuffer.wrap("value".getBytes()), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(oldKs.name).getColumnFamilyStore(cfName);
         assert store != null;
@@ -395,11 +396,11 @@ public class DefsTest extends CleanupHel
         }
         
         // write on old should fail.
-        rm = new RowMutation(oldKs.name, "any key will do".getBytes());
+        rm = new RowMutation(oldKs.name, ByteBuffer.wrap("any key will do".getBytes()));
         boolean success = true;
         try
         {
-            rm.add(new QueryPath(cfName, null, "col0".getBytes()), "value0".getBytes(), 1L);
+            rm.add(new QueryPath(cfName, null, ByteBuffer.wrap("col0".getBytes())), ByteBuffer.wrap("value0".getBytes()), 1L);
             rm.apply();
         }
         catch (Throwable th)
@@ -410,22 +411,22 @@ public class DefsTest extends CleanupHel
         
         // write on new should work.
         rm = new RowMutation(newKsName, dk.key);
-        rm.add(new QueryPath(cfName, null, "col0".getBytes()), "newvalue".getBytes(), 2L);
+        rm.add(new QueryPath(cfName, null, ByteBuffer.wrap("col0".getBytes())), ByteBuffer.wrap("newvalue".getBytes()), 2L);
         rm.apply();
         store = Table.open(newKs.name).getColumnFamilyStore(cfName);
         assert store != null;
         store.forceBlockingFlush();
         
         // read on new should work.
-        SortedSet<byte[]> cols = new TreeSet<byte[]>(BytesType.instance);
-        cols.add("col0".getBytes());
-        cols.add("col1".getBytes());
+        SortedSet<ByteBuffer> cols = new TreeSet<ByteBuffer>(BytesType.instance);
+        cols.add(ByteBuffer.wrap("col0".getBytes()));
+        cols.add(ByteBuffer.wrap("col1".getBytes()));
         ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(cfName), cols));
         assert cfam.getColumnCount() == cols.size();
         // tests new write.
-        assert Arrays.equals(cfam.getColumn("col0".getBytes()).value(), "newvalue".getBytes());
+        assert Arrays.equals(cfam.getColumn(ByteBuffer.wrap("col0".getBytes())).value().array(), "newvalue".getBytes());
         // tests old write.
-        assert Arrays.equals(cfam.getColumn("col1".getBytes()).value(), "value".getBytes());
+        assert Arrays.equals(cfam.getColumn(ByteBuffer.wrap("col1".getBytes())).value().array(), "value".getBytes());
     }
 
     @Test
@@ -452,16 +453,16 @@ public class DefsTest extends CleanupHel
         // now read and write to it.
         DecoratedKey dk = Util.dk("key0");
         RowMutation rm = new RowMutation(newKs.name, dk.key);
-        rm.add(new QueryPath(newCf.cfName, null, "col0".getBytes()), "value0".getBytes(), 1L);
+        rm.add(new QueryPath(newCf.cfName, null, ByteBuffer.wrap("col0".getBytes())), ByteBuffer.wrap("value0".getBytes()), 1L);
         rm.apply();
         ColumnFamilyStore store = Table.open(newKs.name).getColumnFamilyStore(newCf.cfName);
         assert store != null;
         store.forceBlockingFlush();
 
-        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(newCf.cfName), "col0".getBytes()));
-        assert cfam.getColumn("col0".getBytes()) != null;
-        IColumn col = cfam.getColumn("col0".getBytes());
-        assert Arrays.equals("value0".getBytes(), col.value());
+        ColumnFamily cfam = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath(newCf.cfName), ByteBuffer.wrap("col0".getBytes())));
+        assert cfam.getColumn(ByteBuffer.wrap("col0".getBytes())) != null;
+        IColumn col = cfam.getColumn(ByteBuffer.wrap("col0".getBytes()));
+        assert ByteBuffer.wrap("value0".getBytes()).equals(col.value());
     }
     
     @Test
@@ -702,7 +703,7 @@ public class DefsTest extends CleanupHel
                               CFMetaData.DEFAULT_MEMTABLE_LIFETIME_IN_MINS,
                               CFMetaData.DEFAULT_MEMTABLE_THROUGHPUT_IN_MB,
                               CFMetaData.DEFAULT_MEMTABLE_OPERATIONS_IN_MILLIONS,
-                              Collections.<byte[], ColumnDefinition>emptyMap());
+                              Collections.<ByteBuffer, ColumnDefinition>emptyMap());
     }
 
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/NameSortTest.java Fri Oct 22 03:23:26 2010
@@ -32,6 +32,7 @@ import org.apache.cassandra.Util;
 import static org.apache.cassandra.Util.addMutation;
 
 import org.apache.cassandra.db.filter.QueryPath;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 import static junit.framework.Assert.assertEquals;
 
@@ -65,15 +66,15 @@ public class NameSortTest extends Cleanu
 
         for (int i = 0; i < N; ++i)
         {
-            byte[] key = Integer.toString(i).getBytes();
+            ByteBuffer key = ByteBuffer.wrap(Integer.toString(i).getBytes());
             RowMutation rm;
 
             // standard
             for (int j = 0; j < 8; ++j)
             {
-                byte[] bytes = j % 2 == 0 ? "a".getBytes() : "b".getBytes();
+                ByteBuffer bytes = ByteBuffer.wrap(j % 2 == 0 ? "a".getBytes() : "b".getBytes());
                 rm = new RowMutation("Keyspace1", key);
-                rm.add(new QueryPath("Standard1", null, ("Column-" + j).getBytes()), bytes, j);
+                rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap(("Column-" + j).getBytes())), bytes, j);
                 rm.apply();
             }
 
@@ -108,9 +109,9 @@ public class NameSortTest extends Cleanu
             Collection<IColumn> columns = cf.getSortedColumns();
             for (IColumn column : columns)
             {
-                int j = Integer.valueOf(new String(column.name()).split("-")[1]);
+                int j = Integer.valueOf(new String(column.name().array()).split("-")[1]);
                 byte[] bytes = j % 2 == 0 ? "a".getBytes() : "b".getBytes();
-                assert Arrays.equals(bytes, column.value());
+                assert Arrays.equals(bytes, column.value().array());
             }
 
             cf = Util.getColumnFamily(table, key, "Super1");
@@ -119,14 +120,14 @@ public class NameSortTest extends Cleanu
             assert superColumns.size() == 8 : cf;
             for (IColumn superColumn : superColumns)
             {
-                int j = Integer.valueOf(new String(superColumn.name()).split("-")[1]);
+                int j = Integer.valueOf(new String(superColumn.name().array()).split("-")[1]);
                 Collection<IColumn> subColumns = superColumn.getSubColumns();
                 assert subColumns.size() == 4;
                 for (IColumn subColumn : subColumns)
                 {
-                    long k = ByteBuffer.wrap(subColumn.name()).getLong();
+                    long k = subColumn.name().getLong(subColumn.name().position()+subColumn.name().arrayOffset());                   
                     byte[] bytes = (j + k) % 2 == 0 ? "a".getBytes() : "b".getBytes();
-                    assert Arrays.equals(bytes, subColumn.value());
+                    assert Arrays.equals(bytes, subColumn.value().array());
                 }
             }
         }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/OneCompactionTest.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 import java.util.Set;
 import java.util.HashSet;
@@ -29,6 +30,7 @@ import org.junit.Test;
 
 import static junit.framework.Assert.assertEquals;
 import org.apache.cassandra.db.filter.QueryPath;
+import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.CleanupHelper;
 
 public class OneCompactionTest extends CleanupHelper
@@ -44,7 +46,7 @@ public class OneCompactionTest extends C
         for (int j = 0; j < insertsPerTable; j++) {
             DecoratedKey key = Util.dk(String.valueOf(j));
             RowMutation rm = new RowMutation("Keyspace1", key.key);
-            rm.add(new QueryPath(columnFamilyName, null, "0".getBytes()), new byte[0], j);
+            rm.add(new QueryPath(columnFamilyName, null, ByteBuffer.wrap("0".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, j);
             rm.apply();
             inserted.add(key);
             store.forceBlockingFlush();

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/ReadMessageTest.java Fri Oct 22 03:23:26 2010
@@ -18,31 +18,31 @@
 */
 package org.apache.cassandra.db;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 
 import org.apache.cassandra.SchemaLoader;
-import org.apache.commons.lang.ArrayUtils;
-import org.junit.Test;
-
+import org.apache.cassandra.Util;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.io.util.DataOutputBuffer;
-
-import org.apache.cassandra.Util;
+import org.apache.cassandra.utils.FBUtilities;
+import org.apache.commons.lang.ArrayUtils;
+import org.junit.Test;
 
 public class ReadMessageTest extends SchemaLoader
 {
     @Test
     public void testMakeReadMessage() throws IOException
     {
-        ArrayList<byte[]> colList = new ArrayList<byte[]>();
-        colList.add("col1".getBytes());
-        colList.add("col2".getBytes());
+        ArrayList<ByteBuffer> colList = new ArrayList<ByteBuffer>();
+        colList.add(ByteBuffer.wrap("col1".getBytes()));
+        colList.add(ByteBuffer.wrap("col2".getBytes()));
         
         ReadCommand rm, rm2;
         DecoratedKey dk = Util.dk("row1");
@@ -51,19 +51,19 @@ public class ReadMessageTest extends Sch
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
 
-        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, 2);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"),FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
         
-        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), true, 5);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBuffer.wrap("a".getBytes()), ByteBuffer.wrap("z".getBytes()), true, 5);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assertEquals(rm2.toString(), rm.toString());
 
-        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ArrayUtils.EMPTY_BYTE_ARRAY, ArrayUtils.EMPTY_BYTE_ARRAY, true, 2);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
 
-        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), "a".getBytes(), "z".getBytes(), true, 5);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBuffer.wrap("a".getBytes()), ByteBuffer.wrap("z".getBytes()), true, 5);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assertEquals(rm2.toString(), rm.toString());
     }
@@ -88,12 +88,12 @@ public class ReadMessageTest extends Sch
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "abcd".getBytes(), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("abcd".getBytes()), 0);
         rm.apply();
 
-        ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), Arrays.asList("Column1".getBytes()));
+        ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), Arrays.asList(ByteBuffer.wrap("Column1".getBytes())));
         Row row = command.getRow(table);
-        IColumn col = row.cf.getColumn("Column1".getBytes());
-        assert Arrays.equals(col.value(), "abcd".getBytes());  
+        IColumn col = row.cf.getColumn(ByteBuffer.wrap("Column1".getBytes()));
+        assert Arrays.equals(col.value().array(), "abcd".getBytes());  
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManager2Test.java Fri Oct 22 03:23:26 2010
@@ -22,6 +22,7 @@ package org.apache.cassandra.db;
 
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 
 import org.junit.Test;
 
@@ -72,7 +73,7 @@ public class RecoveryManager2Test extend
 
     private void insertRow(String cfname, String key) throws IOException
     {
-        RowMutation rm = new RowMutation("Keyspace1", key.getBytes());
+        RowMutation rm = new RowMutation("Keyspace1", ByteBuffer.wrap(key.getBytes()));
         ColumnFamily cf = ColumnFamily.create("Keyspace1", cfname);
         cf.addColumn(column("col1", "val1", 1L));
         rm.add(cf);

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java Fri Oct 22 03:23:26 2010
@@ -23,6 +23,7 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertNull;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 
 import org.apache.cassandra.CleanupHelper;
@@ -50,7 +51,7 @@ public class RecoveryManagerTruncateTest
 		ColumnFamily cf;
 
 		// trucate clears memtable
-		rm = new RowMutation("Keyspace1", "keymulti".getBytes());
+		rm = new RowMutation("Keyspace1", ByteBuffer.wrap("keymulti".getBytes()));
 		cf = ColumnFamily.create("Keyspace1", "Standard1");
 		cf.addColumn(column("col1", "val1", 1L));
 		rm.add(cf);
@@ -67,7 +68,7 @@ public class RecoveryManagerTruncateTest
 		assertNull(getFromTable(table, "Standard1", "keymulti", "col1"));
 
 		// truncate clears sstable
-		rm = new RowMutation("Keyspace1", "keymulti".getBytes());
+		rm = new RowMutation("Keyspace1", ByteBuffer.wrap("keymulti".getBytes()));
 		cf = ColumnFamily.create("Keyspace1", "Standard1");
 		cf.addColumn(column("col1", "val1", 1L));
 		rm.add(cf);
@@ -87,11 +88,11 @@ public class RecoveryManagerTruncateTest
 			return null;
 		}
 		cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(
-		        Util.dk(keyName), new QueryPath(cfName), columnName.getBytes()));
+		        Util.dk(keyName), new QueryPath(cfName), ByteBuffer.wrap(columnName.getBytes())));
 		if (cf == null)
 		{
 			return null;
 		}
-		return cf.getColumn(columnName.getBytes());
+		return cf.getColumn(ByteBuffer.wrap(columnName.getBytes()));
 	}
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 
 import org.junit.Test;
@@ -42,7 +43,7 @@ public class RemoveColumnFamilyTest exte
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
         rm.apply();
 
         // remove
@@ -50,9 +51,9 @@ public class RemoveColumnFamilyTest exte
         rm.delete(new QueryPath("Standard1"), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, "Column1".getBytes())));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes()))));
         assert retrieved.isMarkedForDelete();
-        assertNull(retrieved.getColumn("Column1".getBytes()));
+        assertNull(retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())));
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 
 import org.junit.Test;
@@ -42,8 +43,8 @@ public class RemoveColumnFamilyWithFlush
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
-        rm.add(new QueryPath("Standard1", null, "Column2".getBytes()), "asdf".getBytes(), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column2".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
         rm.apply();
         store.forceBlockingFlush();
 
@@ -54,7 +55,7 @@ public class RemoveColumnFamilyWithFlush
 
         ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1")));
         assert retrieved.isMarkedForDelete();
-        assertNull(retrieved.getColumn("Column1".getBytes()));
+        assertNull(retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())));
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 
 import org.junit.Test;
@@ -42,7 +43,7 @@ public class RemoveColumnFamilyWithFlush
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
         rm.apply();
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
@@ -50,9 +51,9 @@ public class RemoveColumnFamilyWithFlush
         rm.apply();
         store.forceBlockingFlush();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, "Column1".getBytes())));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes()))));
         assert retrieved.isMarkedForDelete();
-        assertNull(retrieved.getColumn("Column1".getBytes()));
+        assertNull(retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())));
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveColumnTest.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 
 import org.junit.Test;
@@ -43,17 +44,17 @@ public class RemoveColumnTest extends Cl
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, "Column1".getBytes()), "asdf".getBytes(), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Standard1", null, "Column1".getBytes()), 1);
+        rm.delete(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Standard1"), "Column1".getBytes()));
-        assert retrieved.getColumn("Column1".getBytes()).isMarkedForDelete();
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Standard1"), ByteBuffer.wrap("Column1".getBytes())));
+        assert retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())).isMarkedForDelete();
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
         assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1"))), Integer.MAX_VALUE));
     }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 
 import org.junit.Test;
@@ -48,11 +49,11 @@ public class RemoveSubColumnTest extends
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super1", "SC1".getBytes(), getBytes(1)), 1);
+        rm.delete(new QueryPath("Super1", ByteBuffer.wrap("SC1".getBytes()), getBytes(1)), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1", "SC1".getBytes())));
-        assert retrieved.getColumn("SC1".getBytes()).getSubColumn(getBytes(1)).isMarkedForDelete();
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1", ByteBuffer.wrap("SC1".getBytes()))));
+        assert retrieved.getColumn(ByteBuffer.wrap("SC1".getBytes())).getSubColumn(getBytes(1)).isMarkedForDelete();
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java Fri Oct 22 03:23:26 2010
@@ -19,6 +19,7 @@
 package org.apache.cassandra.db;
 
 import java.io.IOException;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 import java.util.Collection;
 
@@ -52,7 +53,7 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super1", "SC1".getBytes()), 1);
+        rm.delete(new QueryPath("Super1", ByteBuffer.wrap("SC1".getBytes())), 1);
         rm.apply();
 
         validateRemoveTwoSources(dk);
@@ -81,7 +82,7 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super3", "SC1".getBytes(), Util.getBytes(1)), 1);
+        rm.delete(new QueryPath("Super3", ByteBuffer.wrap("SC1".getBytes()), Util.getBytes(1)), 1);
         rm.apply();
 
         validateRemoveSubColumn(dk);
@@ -93,20 +94,20 @@ public class RemoveSuperColumnTest exten
     private void validateRemoveSubColumn(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super3");
-        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", "SC1".getBytes()), Util.getBytes(1)));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", ByteBuffer.wrap("SC1".getBytes())), Util.getBytes(1)));
         assertNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
-        cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", "SC1".getBytes()), Util.getBytes(2)));
+        cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", ByteBuffer.wrap("SC1".getBytes())), Util.getBytes(2)));
         assertNotNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
     }
 
     private void validateRemoveTwoSources(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
-        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), "SC1".getBytes()));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), ByteBuffer.wrap("SC1".getBytes())));
         assert cf.getSortedColumns().iterator().next().getMarkedForDeleteAt() == 1 : cf;
         assert cf.getSortedColumns().iterator().next().getSubColumns().size() == 0 : cf;
         assertNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
-        cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), "SC1".getBytes()));
+        cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), ByteBuffer.wrap("SC1".getBytes())));
         assertNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
         cf = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1")));
         assertNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
@@ -116,7 +117,7 @@ public class RemoveSuperColumnTest exten
     private void validateRemoveCompacted(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super1");
-        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), "SC1".getBytes()));
+        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), ByteBuffer.wrap("SC1".getBytes())));
         assert resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt() == 1;
         Collection<IColumn> subColumns = resolved.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 0;
@@ -137,7 +138,7 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super2", "SC1".getBytes()), 1);
+        rm.delete(new QueryPath("Super2", ByteBuffer.wrap("SC1".getBytes())), 1);
         rm.apply();
 
         // new data
@@ -158,7 +159,7 @@ public class RemoveSuperColumnTest exten
     private void validateRemoveWithNewData(DecoratedKey dk) throws IOException
     {
         ColumnFamilyStore store = Table.open("Keyspace1").getColumnFamilyStore("Super2");
-        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super2", "SC1".getBytes()), getBytes(2)));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super2", ByteBuffer.wrap("SC1".getBytes())), getBytes(2)));
         Collection<IColumn> subColumns = cf.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 1;
         assert subColumns.iterator().next().timestamp() == 2;
@@ -178,9 +179,9 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", key.key);
-        rm.delete(new QueryPath("Super2", "SC1".getBytes()), 1);
+        rm.delete(new QueryPath("Super2", ByteBuffer.wrap("SC1".getBytes())), 1);
         rm.apply();
-        assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), "SC1".getBytes())), Integer.MAX_VALUE));
+        assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBuffer.wrap("SC1".getBytes()))), Integer.MAX_VALUE));
 
         // resurrect
         rm = new RowMutation("Keyspace1", key.key);
@@ -188,7 +189,7 @@ public class RemoveSuperColumnTest exten
         rm.apply();
 
         // validate
-        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), "SC1".getBytes()));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBuffer.wrap("SC1".getBytes())));
         cf = Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE);
         Collection<IColumn> subColumns = cf.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 1;

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RowIterationTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RowIterationTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RowIterationTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RowIterationTest.java Fri Oct 22 03:23:26 2010
@@ -20,6 +20,7 @@ package org.apache.cassandra.db;
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.nio.ByteBuffer;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
 import java.util.ArrayList;
@@ -52,7 +53,7 @@ public class RowIterationTest extends Cl
         for (int i = 0; i < ROWS_PER_SSTABLE; i++) {
             DecoratedKey key = Util.dk(String.valueOf(i));
             RowMutation rm = new RowMutation(TABLE1, key.key);
-            rm.add(new QueryPath("Super3", "sc".getBytes(), String.valueOf(i).getBytes()), new byte[ROWS_PER_SSTABLE * 10 - i * 2], i);
+            rm.add(new QueryPath("Super3", ByteBuffer.wrap("sc".getBytes()), ByteBuffer.wrap(String.valueOf(i).getBytes())), ByteBuffer.wrap(new byte[ROWS_PER_SSTABLE * 10 - i * 2]), i);
             rm.apply();
             inserted.add(key);
         }

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/RowTest.java Fri Oct 22 03:23:26 2010
@@ -18,6 +18,7 @@
 */
 package org.apache.cassandra.db;
 
+import java.nio.ByteBuffer;
 import java.util.Arrays;
 
 import org.apache.cassandra.SchemaLoader;
@@ -47,10 +48,10 @@ public class RowTest extends SchemaLoade
     @Test
     public void testDiffSuperColumn()
     {
-        SuperColumn sc1 = new SuperColumn("one".getBytes(), AsciiType.instance);
+        SuperColumn sc1 = new SuperColumn(ByteBuffer.wrap("one".getBytes()), AsciiType.instance);
         sc1.addColumn(column("subcolumn", "A", 0));
 
-        SuperColumn sc2 = new SuperColumn("one".getBytes(), AsciiType.instance);
+        SuperColumn sc2 = new SuperColumn(ByteBuffer.wrap("one".getBytes()), AsciiType.instance);
         sc2.markForDeleteAt(0, 0);
 
         SuperColumn scDiff = (SuperColumn)sc1.diff(sc2);
@@ -69,14 +70,14 @@ public class RowTest extends SchemaLoade
         cf2.addColumn(column("two", "C", 1));
 
         cf1.resolve(cf2);
-        assert Arrays.equals(cf1.getColumn("one".getBytes()).value(), "B".getBytes());
-        assert Arrays.equals(cf1.getColumn("two".getBytes()).value(), "C".getBytes());
+        assert Arrays.equals(cf1.getColumn(ByteBuffer.wrap("one".getBytes())).value().array(), "B".getBytes());
+        assert Arrays.equals(cf1.getColumn(ByteBuffer.wrap("two".getBytes())).value().array(), "C".getBytes());
     }
 
     @Test
     public void testExpiringColumnExpiration()
     {
-        Column c = new ExpiringColumn("one".getBytes(), "A".getBytes(), 0, 1);
+        Column c = new ExpiringColumn(ByteBuffer.wrap("one".getBytes()), ByteBuffer.wrap("A".getBytes()), 0, 1);
         assert !c.isMarkedForDelete();
 
         try

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java?rev=1026200&r1=1026199&r2=1026200&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/SuperColumnTest.java Fri Oct 22 03:23:26 2010
@@ -17,6 +17,8 @@
 */
 package org.apache.cassandra.db;
 
+import java.nio.ByteBuffer;
+
 import org.junit.Test;
 
 import static junit.framework.Assert.assertNotNull;
@@ -28,8 +30,8 @@ public class SuperColumnTest
 {   
     @Test
     public void testMissingSubcolumn() {
-    	SuperColumn sc = new SuperColumn("sc1".getBytes(), LongType.instance);
-    	sc.addColumn(new Column(getBytes(1), "value".getBytes(), 1));
+    	SuperColumn sc = new SuperColumn(ByteBuffer.wrap("sc1".getBytes()), LongType.instance);
+    	sc.addColumn(new Column(getBytes(1), ByteBuffer.wrap("value".getBytes()), 1));
     	assertNotNull(sc.getSubColumn(getBytes(1)));
     	assertNull(sc.getSubColumn(getBytes(2)));
     }



Mime
View raw message