You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2010/10/26 05:14:10 UTC

svn commit: r1027349 [2/2] - in /cassandra/branches/cassandra-0.7: contrib/client_only/ contrib/pig/src/java/org/apache/cassandra/hadoop/pig/ contrib/word_count/src/ src/java/org/apache/cassandra/db/ src/java/org/apache/cassandra/db/migration/ src/java...

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/ReadMessageTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/ReadMessageTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/ReadMessageTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/ReadMessageTest.java Tue Oct 26 03:14:08 2010
@@ -34,6 +34,8 @@ import org.apache.cassandra.io.util.Data
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.commons.lang.ArrayUtils;
 import org.junit.Test;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class ReadMessageTest extends SchemaLoader
 {
@@ -41,8 +43,8 @@ public class ReadMessageTest extends Sch
     public void testMakeReadMessage() throws IOException
     {
         ArrayList<ByteBuffer> colList = new ArrayList<ByteBuffer>();
-        colList.add(ByteBuffer.wrap("col1".getBytes()));
-        colList.add(ByteBuffer.wrap("col2".getBytes()));
+        colList.add(ByteBufferUtil.bytes("col1"));
+        colList.add(ByteBufferUtil.bytes("col2"));
         
         ReadCommand rm, rm2;
         DecoratedKey dk = Util.dk("row1");
@@ -55,7 +57,7 @@ public class ReadMessageTest extends Sch
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
         
-        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBuffer.wrap("a".getBytes()), ByteBuffer.wrap("z".getBytes()), true, 5);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("z"), true, 5);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assertEquals(rm2.toString(), rm.toString());
 
@@ -63,7 +65,7 @@ public class ReadMessageTest extends Sch
         rm2 = serializeAndDeserializeReadMessage(rm);
         assert rm2.toString().equals(rm.toString());
 
-        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBuffer.wrap("a".getBytes()), ByteBuffer.wrap("z".getBytes()), true, 5);
+        rm = new SliceFromReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("z"), true, 5);
         rm2 = serializeAndDeserializeReadMessage(rm);
         assertEquals(rm2.toString(), rm.toString());
     }
@@ -88,12 +90,12 @@ public class ReadMessageTest extends Sch
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("abcd".getBytes()), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("abcd"), 0);
         rm.apply();
 
-        ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), Arrays.asList(ByteBuffer.wrap("Column1".getBytes())));
+        ReadCommand command = new SliceByNamesReadCommand("Keyspace1", dk.key, new QueryPath("Standard1"), Arrays.asList(ByteBufferUtil.bytes("Column1")));
         Row row = command.getRow(table);
-        IColumn col = row.cf.getColumn(ByteBuffer.wrap("Column1".getBytes()));
+        IColumn col = row.cf.getColumn(ByteBufferUtil.bytes("Column1"));
         assert Arrays.equals(col.value().array(), "abcd".getBytes());  
     }
 }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RecoveryManagerTruncateTest.java Tue Oct 26 03:14:08 2010
@@ -32,6 +32,7 @@ import org.apache.cassandra.db.commitlog
 import org.apache.cassandra.db.filter.QueryFilter;
 import org.apache.cassandra.db.filter.QueryPath;
 import org.junit.Test;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 /**
  * Test for the truncate operation.
@@ -51,7 +52,7 @@ public class RecoveryManagerTruncateTest
 		ColumnFamily cf;
 
 		// trucate clears memtable
-		rm = new RowMutation("Keyspace1", ByteBuffer.wrap("keymulti".getBytes()));
+		rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("keymulti"));
 		cf = ColumnFamily.create("Keyspace1", "Standard1");
 		cf.addColumn(column("col1", "val1", 1L));
 		rm.add(cf);
@@ -68,7 +69,7 @@ public class RecoveryManagerTruncateTest
 		assertNull(getFromTable(table, "Standard1", "keymulti", "col1"));
 
 		// truncate clears sstable
-		rm = new RowMutation("Keyspace1", ByteBuffer.wrap("keymulti".getBytes()));
+		rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("keymulti"));
 		cf = ColumnFamily.create("Keyspace1", "Standard1");
 		cf.addColumn(column("col1", "val1", 1L));
 		rm.add(cf);

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyTest.java Tue Oct 26 03:14:08 2010
@@ -30,6 +30,8 @@ import org.apache.cassandra.db.filter.Qu
 
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.Util;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RemoveColumnFamilyTest extends CleanupHelper
 {
@@ -43,7 +45,7 @@ public class RemoveColumnFamilyTest exte
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdf"), 0);
         rm.apply();
 
         // remove
@@ -51,9 +53,9 @@ public class RemoveColumnFamilyTest exte
         rm.delete(new QueryPath("Standard1"), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes()))));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1"))));
         assert retrieved.isMarkedForDelete();
-        assertNull(retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())));
+        assertNull(retrieved.getColumn(ByteBufferUtil.bytes("Column1")));
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush1Test.java Tue Oct 26 03:14:08 2010
@@ -30,6 +30,8 @@ import org.apache.cassandra.db.filter.Qu
 
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.Util;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RemoveColumnFamilyWithFlush1Test extends CleanupHelper
 {
@@ -43,8 +45,8 @@ public class RemoveColumnFamilyWithFlush
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        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.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdf"), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column2")), ByteBufferUtil.bytes("asdf"), 0);
         rm.apply();
         store.forceBlockingFlush();
 
@@ -55,7 +57,7 @@ public class RemoveColumnFamilyWithFlush
 
         ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1")));
         assert retrieved.isMarkedForDelete();
-        assertNull(retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())));
+        assertNull(retrieved.getColumn(ByteBufferUtil.bytes("Column1")));
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnFamilyWithFlush2Test.java Tue Oct 26 03:14:08 2010
@@ -30,6 +30,8 @@ import org.apache.cassandra.db.filter.Qu
 
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.Util;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RemoveColumnFamilyWithFlush2Test extends CleanupHelper
 {
@@ -43,7 +45,7 @@ public class RemoveColumnFamilyWithFlush
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdf"), 0);
         rm.apply();
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
@@ -51,9 +53,9 @@ public class RemoveColumnFamilyWithFlush
         rm.apply();
         store.forceBlockingFlush();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes()))));
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1"))));
         assert retrieved.isMarkedForDelete();
-        assertNull(retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())));
+        assertNull(retrieved.getColumn(ByteBufferUtil.bytes("Column1")));
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveColumnTest.java Tue Oct 26 03:14:08 2010
@@ -31,6 +31,8 @@ import org.apache.cassandra.db.filter.Qu
 
 import org.apache.cassandra.CleanupHelper;
 import org.apache.cassandra.Util;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RemoveColumnTest extends CleanupHelper
 {
@@ -44,17 +46,17 @@ public class RemoveColumnTest extends Cl
 
         // add data
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdf"), 0);
         rm.apply();
         store.forceBlockingFlush();
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Standard1", null, ByteBuffer.wrap("Column1".getBytes())), 1);
+        rm.delete(new QueryPath("Standard1", null, ByteBufferUtil.bytes("Column1")), 1);
         rm.apply();
 
-        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Standard1"), ByteBuffer.wrap("Column1".getBytes())));
-        assert retrieved.getColumn(ByteBuffer.wrap("Column1".getBytes())).isMarkedForDelete();
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Standard1"), ByteBufferUtil.bytes("Column1")));
+        assert retrieved.getColumn(ByteBufferUtil.bytes("Column1")).isMarkedForDelete();
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
         assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Standard1"))), Integer.MAX_VALUE));
     }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSubColumnTest.java Tue Oct 26 03:14:08 2010
@@ -30,6 +30,8 @@ import org.apache.cassandra.db.filter.Qu
 import static org.apache.cassandra.Util.getBytes;
 import org.apache.cassandra.Util;
 import org.apache.cassandra.CleanupHelper;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RemoveSubColumnTest extends CleanupHelper
 {
@@ -49,11 +51,11 @@ public class RemoveSubColumnTest extends
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super1", ByteBuffer.wrap("SC1".getBytes()), getBytes(1)), 1);
+        rm.delete(new QueryPath("Super1", ByteBufferUtil.bytes("SC1"), getBytes(1)), 1);
         rm.apply();
 
-        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();
+        ColumnFamily retrieved = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1", ByteBufferUtil.bytes("SC1"))));
+        assert retrieved.getColumn(ByteBufferUtil.bytes("SC1")).getSubColumn(getBytes(1)).isMarkedForDelete();
         assertNull(Util.cloneAndRemoveDeleted(retrieved, Integer.MAX_VALUE));
     }
 }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RemoveSuperColumnTest.java Tue Oct 26 03:14:08 2010
@@ -35,6 +35,8 @@ import static org.apache.cassandra.Util.
 
 import org.apache.cassandra.CleanupHelper;
 import static junit.framework.Assert.assertNotNull;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RemoveSuperColumnTest extends CleanupHelper
 {
@@ -53,7 +55,7 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super1", ByteBuffer.wrap("SC1".getBytes())), 1);
+        rm.delete(new QueryPath("Super1", ByteBufferUtil.bytes("SC1")), 1);
         rm.apply();
 
         validateRemoveTwoSources(dk);
@@ -82,7 +84,7 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super3", ByteBuffer.wrap("SC1".getBytes()), Util.getBytes(1)), 1);
+        rm.delete(new QueryPath("Super3", ByteBufferUtil.bytes("SC1"), Util.getBytes(1)), 1);
         rm.apply();
 
         validateRemoveSubColumn(dk);
@@ -94,20 +96,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", ByteBuffer.wrap("SC1".getBytes())), Util.getBytes(1)));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", ByteBufferUtil.bytes("SC1")), Util.getBytes(1)));
         assertNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
-        cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", ByteBuffer.wrap("SC1".getBytes())), Util.getBytes(2)));
+        cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super3", ByteBufferUtil.bytes("SC1")), 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"), ByteBuffer.wrap("SC1".getBytes())));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), ByteBufferUtil.bytes("SC1")));
         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"), ByteBuffer.wrap("SC1".getBytes())));
+        cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), ByteBufferUtil.bytes("SC1")));
         assertNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
         cf = store.getColumnFamily(QueryFilter.getIdentityFilter(dk, new QueryPath("Super1")));
         assertNull(Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE));
@@ -117,7 +119,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"), ByteBuffer.wrap("SC1".getBytes())));
+        ColumnFamily resolved = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super1"), ByteBufferUtil.bytes("SC1")));
         assert resolved.getSortedColumns().iterator().next().getMarkedForDeleteAt() == 1;
         Collection<IColumn> subColumns = resolved.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 0;
@@ -138,7 +140,7 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", dk.key);
-        rm.delete(new QueryPath("Super2", ByteBuffer.wrap("SC1".getBytes())), 1);
+        rm.delete(new QueryPath("Super2", ByteBufferUtil.bytes("SC1")), 1);
         rm.apply();
 
         // new data
@@ -159,7 +161,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", ByteBuffer.wrap("SC1".getBytes())), getBytes(2)));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(dk, new QueryPath("Super2", ByteBufferUtil.bytes("SC1")), getBytes(2)));
         Collection<IColumn> subColumns = cf.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 1;
         assert subColumns.iterator().next().timestamp() == 2;
@@ -179,9 +181,9 @@ public class RemoveSuperColumnTest exten
 
         // remove
         rm = new RowMutation("Keyspace1", key.key);
-        rm.delete(new QueryPath("Super2", ByteBuffer.wrap("SC1".getBytes())), 1);
+        rm.delete(new QueryPath("Super2", ByteBufferUtil.bytes("SC1")), 1);
         rm.apply();
-        assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBuffer.wrap("SC1".getBytes()))), Integer.MAX_VALUE));
+        assertNull(Util.cloneAndRemoveDeleted(store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBufferUtil.bytes("SC1"))), Integer.MAX_VALUE));
 
         // resurrect
         rm = new RowMutation("Keyspace1", key.key);
@@ -189,7 +191,7 @@ public class RemoveSuperColumnTest exten
         rm.apply();
 
         // validate
-        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBuffer.wrap("SC1".getBytes())));
+        ColumnFamily cf = store.getColumnFamily(QueryFilter.getNamesFilter(key, new QueryPath("Super2"), ByteBufferUtil.bytes("SC1")));
         cf = Util.cloneAndRemoveDeleted(cf, Integer.MAX_VALUE);
         Collection<IColumn> subColumns = cf.getSortedColumns().iterator().next().getSubColumns();
         assert subColumns.size() == 1;

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowIterationTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowIterationTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowIterationTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowIterationTest.java Tue Oct 26 03:14:08 2010
@@ -36,6 +36,8 @@ import org.apache.cassandra.CleanupHelpe
 import org.apache.cassandra.db.filter.QueryPath;
 import org.apache.cassandra.utils.FBUtilities;
 import static junit.framework.Assert.assertEquals;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RowIterationTest extends CleanupHelper
 {
@@ -53,7 +55,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", ByteBuffer.wrap("sc".getBytes()), ByteBuffer.wrap(String.valueOf(i).getBytes())), ByteBuffer.wrap(new byte[ROWS_PER_SSTABLE * 10 - i * 2]), i);
+            rm.add(new QueryPath("Super3", ByteBufferUtil.bytes("sc"), ByteBuffer.wrap(String.valueOf(i).getBytes())), ByteBuffer.wrap(new byte[ROWS_PER_SSTABLE * 10 - i * 2]), i);
             rm.apply();
             inserted.add(key);
         }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/RowTest.java Tue Oct 26 03:14:08 2010
@@ -28,6 +28,8 @@ import static junit.framework.Assert.ass
 import static junit.framework.Assert.fail;
 import org.apache.cassandra.db.marshal.AsciiType;
 import static org.apache.cassandra.Util.column;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class RowTest extends SchemaLoader
 {
@@ -48,10 +50,10 @@ public class RowTest extends SchemaLoade
     @Test
     public void testDiffSuperColumn()
     {
-        SuperColumn sc1 = new SuperColumn(ByteBuffer.wrap("one".getBytes()), AsciiType.instance);
+        SuperColumn sc1 = new SuperColumn(ByteBufferUtil.bytes("one"), AsciiType.instance);
         sc1.addColumn(column("subcolumn", "A", 0));
 
-        SuperColumn sc2 = new SuperColumn(ByteBuffer.wrap("one".getBytes()), AsciiType.instance);
+        SuperColumn sc2 = new SuperColumn(ByteBufferUtil.bytes("one"), AsciiType.instance);
         sc2.markForDeleteAt(0, 0);
 
         SuperColumn scDiff = (SuperColumn)sc1.diff(sc2);
@@ -70,14 +72,14 @@ public class RowTest extends SchemaLoade
         cf2.addColumn(column("two", "C", 1));
 
         cf1.resolve(cf2);
-        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());
+        assert Arrays.equals(cf1.getColumn(ByteBufferUtil.bytes("one")).value().array(), "B".getBytes());
+        assert Arrays.equals(cf1.getColumn(ByteBufferUtil.bytes("two")).value().array(), "C".getBytes());
     }
 
     @Test
     public void testExpiringColumnExpiration()
     {
-        Column c = new ExpiringColumn(ByteBuffer.wrap("one".getBytes()), ByteBuffer.wrap("A".getBytes()), 0, 1);
+        Column c = new ExpiringColumn(ByteBufferUtil.bytes("one"), ByteBufferUtil.bytes("A"), 0, 1);
         assert !c.isMarkedForDelete();
 
         try

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/SuperColumnTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/SuperColumnTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/SuperColumnTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/SuperColumnTest.java Tue Oct 26 03:14:08 2010
@@ -25,13 +25,15 @@ import static junit.framework.Assert.ass
 import static junit.framework.Assert.assertNull;
 import static org.apache.cassandra.Util.getBytes;
 import org.apache.cassandra.db.marshal.LongType;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class SuperColumnTest
 {   
     @Test
     public void testMissingSubcolumn() {
-    	SuperColumn sc = new SuperColumn(ByteBuffer.wrap("sc1".getBytes()), LongType.instance);
-    	sc.addColumn(new Column(getBytes(1), ByteBuffer.wrap("value".getBytes()), 1));
+    	SuperColumn sc = new SuperColumn(ByteBufferUtil.bytes("sc1"), LongType.instance);
+    	sc.addColumn(new Column(getBytes(1), ByteBufferUtil.bytes("value"), 1));
     	assertNotNull(sc.getSubColumn(getBytes(1)));
     	assertNull(sc.getSubColumn(getBytes(2)));
     }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TableTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TableTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TableTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TableTest.java Tue Oct 26 03:14:08 2010
@@ -43,6 +43,8 @@ import org.apache.cassandra.io.sstable.I
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.io.util.BufferedRandomAccessFile;
 import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class TableTest extends CleanupHelper
 {
@@ -81,7 +83,7 @@ public class TableTest extends CleanupHe
                 cf = cfStore.getColumnFamily(QueryFilter.getSliceFilter(TEST_KEY, new QueryPath("Standard3"), FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, 0));
                 assertColumns(cf);
 
-                cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(TEST_KEY, new QueryPath("Standard3"), ByteBuffer.wrap("col99".getBytes())));
+                cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(TEST_KEY, new QueryPath("Standard3"), ByteBufferUtil.bytes("col99")));
                 assertColumns(cf);
             }
         };
@@ -108,10 +110,10 @@ public class TableTest extends CleanupHe
             {
                 ColumnFamily cf;
 
-                cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(TEST_KEY, new QueryPath("Standard1"), ByteBuffer.wrap("col1".getBytes())));
+                cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(TEST_KEY, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1")));
                 assertColumns(cf, "col1");
 
-                cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(TEST_KEY, new QueryPath("Standard1"), ByteBuffer.wrap("col3".getBytes())));
+                cf = cfStore.getColumnFamily(QueryFilter.getNamesFilter(TEST_KEY, new QueryPath("Standard1"), ByteBufferUtil.bytes("col3")));
                 assertColumns(cf, "col3");
             }
         };
@@ -133,16 +135,16 @@ public class TableTest extends CleanupHe
         rm.add(cf);
         rm.apply();
         
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("b".getBytes()), ByteBuffer.wrap("c".getBytes()), false, 100);
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("c"), false, 100);
         assertEquals(2, cf.getColumnCount());
         
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("b".getBytes()), ByteBuffer.wrap("b".getBytes()), false, 100);
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("b"), false, 100);
         assertEquals(1, cf.getColumnCount());
         
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("b".getBytes()), ByteBuffer.wrap("c".getBytes()), false, 1);
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("b"), ByteBufferUtil.bytes("c"), false, 1);
         assertEquals(1, cf.getColumnCount());
         
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("c".getBytes()), ByteBuffer.wrap("b".getBytes()), false, 1);
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("c"), ByteBufferUtil.bytes("b"), false, 1);
         assertNull(cf);
     }
 
@@ -150,7 +152,7 @@ public class TableTest extends CleanupHe
     public void testGetSliceNoMatch() throws Throwable
     {
         Table table = Table.open("Keyspace1");
-        RowMutation rm = new RowMutation("Keyspace1", ByteBuffer.wrap("row1000".getBytes()));
+        RowMutation rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("row1000"));
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Standard2");
         cf.addColumn(column("col1", "val1", 1));
         rm.add(cf);
@@ -194,30 +196,30 @@ public class TableTest extends CleanupHe
                 assert DatabaseDescriptor.getColumnIndexSize() == 4096 : "Unexpected column index size, block boundaries won't be where tests expect them.";
 
                 // test forward, spanning a segment.
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col096".getBytes()), ByteBuffer.wrap("col099".getBytes()), false, 4);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col096"), ByteBufferUtil.bytes("col099"), false, 4);
                 assertColumns(cf, "col096", "col097", "col098", "col099");
 
                 // test reversed, spanning a segment.
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col099".getBytes()), ByteBuffer.wrap("col096".getBytes()), true, 4);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col099"), ByteBufferUtil.bytes("col096"), true, 4);
                 assertColumns(cf, "col096", "col097", "col098", "col099");
 
                 // test forward, within a segment.
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col100".getBytes()), ByteBuffer.wrap("col103".getBytes()), false, 4);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col100"), ByteBufferUtil.bytes("col103"), false, 4);
                 assertColumns(cf, "col100", "col101", "col102", "col103");
 
                 // test reversed, within a segment.
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col103".getBytes()), ByteBuffer.wrap("col100".getBytes()), true, 4);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col103"), ByteBufferUtil.bytes("col100"), true, 4);
                 assertColumns(cf, "col100", "col101", "col102", "col103");
 
                 // test forward from beginning, spanning a segment.
                 String[] strCols = new String[100]; // col000-col099
                 for (int i = 0; i < 100; i++)
                     strCols[i] = "col" + fmt.format(i);
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), FBUtilities.EMPTY_BYTE_BUFFER, ByteBuffer.wrap("col099".getBytes()), false, 100);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), FBUtilities.EMPTY_BYTE_BUFFER, ByteBufferUtil.bytes("col099"), false, 100);
                 assertColumns(cf, strCols);
 
                 // test reversed, from end, spanning a segment.
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), FBUtilities.EMPTY_BYTE_BUFFER, ByteBuffer.wrap("col288".getBytes()), true, 12);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), FBUtilities.EMPTY_BYTE_BUFFER, ByteBufferUtil.bytes("col288"), true, 12);
                 assertColumns(cf, "col288", "col289", "col290", "col291", "col292", "col293", "col294", "col295", "col296", "col297", "col298", "col299");
             }
         };
@@ -291,7 +293,7 @@ public class TableTest extends CleanupHe
         rm.apply();
 
         rm = new RowMutation("Keyspace1", ROW.key);
-        rm.delete(new QueryPath("Standard1", null, ByteBuffer.wrap("col4".getBytes())), 2L);
+        rm.delete(new QueryPath("Standard1", null, ByteBufferUtil.bytes("col4")), 2L);
         rm.apply();
 
         Runnable verify = new WrappedRunnable()
@@ -300,26 +302,26 @@ public class TableTest extends CleanupHe
             {
                 ColumnFamily cf;
 
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col5".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, false, 2);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col5"), FBUtilities.EMPTY_BYTE_BUFFER, false, 2);
                 assertColumns(cf, "col5", "col7");
 
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col4".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, false, 2);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col4"), FBUtilities.EMPTY_BYTE_BUFFER, false, 2);
                 assertColumns(cf, "col4", "col5", "col7");
                 assertColumns(ColumnFamilyStore.removeDeleted(cf, Integer.MAX_VALUE), "col5", "col7");
 
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col5".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col5"), FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
                 assertColumns(cf, "col3", "col4", "col5");
 
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col6".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col6"), FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
                 assertColumns(cf, "col3", "col4", "col5");
 
                 cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
                 assertColumns(cf, "col7", "col9");
 
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col95".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, false, 2);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col95"), FBUtilities.EMPTY_BYTE_BUFFER, false, 2);
                 assertColumns(cf);
 
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col0".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col0"), FBUtilities.EMPTY_BYTE_BUFFER, true, 2);
                 assertColumns(cf);
             }
         };
@@ -361,11 +363,17 @@ public class TableTest extends CleanupHe
             {
                 ColumnFamily cf;
 
-                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBuffer.wrap("col2".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
+                cf = cfStore.getColumnFamily(ROW, new QueryPath("Standard1"), ByteBufferUtil.bytes("col2"), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
                 assertColumns(cf, "col2", "col3", "col4");
-                assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col2".getBytes())).value().array()), "valx");
-                assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col3".getBytes())).value().array()), "valx");
-                assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col4".getBytes())).value().array()), "val4");
+                
+                ByteBuffer col = cf.getColumn(ByteBufferUtil.bytes("col2")).value();
+                assertEquals(new String(col.array(),col.position(),col.remaining()), "valx");
+                
+                col = cf.getColumn(ByteBufferUtil.bytes("col3")).value();
+                assertEquals(new String(col.array(),col.position(),col.remaining()), "valx");
+                
+                col = cf.getColumn(ByteBufferUtil.bytes("col4")).value();
+                assertEquals(new String(col.array(),col.position(),col.remaining()), "val4");                              
             }
         };
 
@@ -409,44 +417,60 @@ public class TableTest extends CleanupHe
     {
         DecoratedKey key = Util.dk("row3");
         ColumnFamily cf;
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("col1000".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1000"), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
         assertColumns(cf, "col1000", "col1001", "col1002");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1000".getBytes())).value().array()), "v1000");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1001".getBytes())).value().array()), "v1001");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1002".getBytes())).value().array()), "v1002");
-
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("col1195".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
+        
+        ByteBuffer col; 
+        col = cf.getColumn(ByteBufferUtil.bytes("col1000")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1000");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1001")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1001");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1002")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1002");
+        
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1195"), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
         assertColumns(cf, "col1195", "col1196", "col1197");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1195".getBytes())).value().array()), "v1195");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1196".getBytes())).value().array()), "v1196");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1197".getBytes())).value().array()), "v1197");
-
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("col1996".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, true, 1000);
+        
+        col = cf.getColumn(ByteBufferUtil.bytes("col1195")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1195");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1196")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1196");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1197")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1197");
+        
+       
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1996"), FBUtilities.EMPTY_BYTE_BUFFER, true, 1000);
         IColumn[] columns = cf.getSortedColumns().toArray(new IColumn[0]);
         for (int i = 1000; i < 1996; i++)
         {
             String expectedName = "col" + i;
             IColumn column = columns[i - 1000];
-            assert Arrays.equals(column.name().array(), expectedName.getBytes()) : cfStore.getComparator().getString(column.name()) + " is not " + expectedName;
-            assert Arrays.equals(column.value().array(), ("v" + i).getBytes());
+            assertEquals(new String(column.name().array(), column.name().position(),column.name().remaining()), expectedName); 
+            assertEquals(new String(column.value().array(), column.value().position(),column.value().remaining()), ("v" + i));
         }
 
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("col1990".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col1990"), FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
         assertColumns(cf, "col1990", "col1991", "col1992");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1990".getBytes())).value().array()), "v1990");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1991".getBytes())).value().array()), "v1991");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1992".getBytes())).value().array()), "v1992");
-
+        col = cf.getColumn(ByteBufferUtil.bytes("col1990")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1990");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1991")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1991");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1992")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1992");
+        
         cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, true, 3);
         assertColumns(cf, "col1997", "col1998", "col1999");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1999".getBytes())).value().array()), "v1999");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1998".getBytes())).value().array()), "v1998");
-        assertEquals(new String(cf.getColumn(ByteBuffer.wrap("col1997".getBytes())).value().array()), "v1997");
-
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("col9000".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER, true, 3);
+        col = cf.getColumn(ByteBufferUtil.bytes("col1997")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1997");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1998")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1998");
+        col = cf.getColumn(ByteBufferUtil.bytes("col1999")).value();
+        assertEquals(new String(col.array(),col.position(),col.remaining()), "v1999");
+        
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col9000"), FBUtilities.EMPTY_BYTE_BUFFER, true, 3);
         assertColumns(cf, "col1997", "col1998", "col1999");
 
-        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBuffer.wrap("col9000".getBytes()),FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
+        cf = cfStore.getColumnFamily(key, new QueryPath("Standard1"), ByteBufferUtil.bytes("col9000"),FBUtilities.EMPTY_BYTE_BUFFER, false, 3);
         assertColumns(cf);
     }
 
@@ -460,8 +484,8 @@ public class TableTest extends CleanupHe
 
         RowMutation rm = new RowMutation("Keyspace1", ROW.key);
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Super1");
-        SuperColumn sc = new SuperColumn(ByteBuffer.wrap("sc1".getBytes()), LongType.instance);
-        sc.addColumn(new Column(getBytes(1), ByteBuffer.wrap("val1".getBytes()), 1L));
+        SuperColumn sc = new SuperColumn(ByteBufferUtil.bytes("sc1"), LongType.instance);
+        sc.addColumn(new Column(getBytes(1), ByteBufferUtil.bytes("val1"), 1L));
         cf.addColumn(sc);
         rm.add(cf);
         rm.apply();
@@ -472,7 +496,10 @@ public class TableTest extends CleanupHe
             {
                 ColumnFamily cf = cfStore.getColumnFamily(ROW, new QueryPath("Super1"), FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER, false, 10);
                 assertColumns(cf, "sc1");
-                assertEquals(new String(cf.getColumn(ByteBuffer.wrap("sc1".getBytes())).getSubColumn(getBytes(1)).value().array()), "val1");
+                
+                ByteBuffer val = cf.getColumn(ByteBufferUtil.bytes("sc1")).getSubColumn(getBytes(1)).value();
+                
+                assertEquals(new String(val.array(),val.position(),val.remaining()), "val1");
             }
         };
 
@@ -485,7 +512,7 @@ public class TableTest extends CleanupHe
         List<String> L = new ArrayList<String>();
         for (IColumn column : columns)
         {
-            L.add(new String(column.name().array()));
+            L.add(new String(column.name().array(),column.name().position(),column.name().remaining()));
         }
 
         List<String> names = new ArrayList<String>(columnNames.length);

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TimeSortTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TimeSortTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TimeSortTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/TimeSortTest.java Tue Oct 26 03:14:08 2010
@@ -36,6 +36,8 @@ import org.apache.cassandra.db.filter.Qu
 import org.apache.cassandra.db.filter.NamesQueryFilter;
 import org.apache.cassandra.db.marshal.LongType;
 import org.apache.cassandra.utils.FBUtilities;
+import org.apache.cassandra.utils.ByteBufferUtil;
+
 
 public class TimeSortTest extends CleanupHelper
 {
@@ -48,12 +50,12 @@ public class TimeSortTest extends Cleanu
         DecoratedKey key = Util.dk("key0");
 
         rm = new RowMutation("Keyspace1", key.key);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(100)), ByteBuffer.wrap("a".getBytes()), 100);
+        rm.add(new QueryPath("StandardLong1", null, getBytes(100)), ByteBufferUtil.bytes("a"), 100);
         rm.apply();
         cfStore.forceBlockingFlush();
 
         rm = new RowMutation("Keyspace1", key.key);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), ByteBuffer.wrap("b".getBytes()), 0);
+        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), ByteBufferUtil.bytes("b"), 0);
         rm.apply();
 
         ColumnFamily cf = cfStore.getColumnFamily(key, new QueryPath("StandardLong1"), getBytes(10), FBUtilities.EMPTY_BYTE_BUFFER, false, 1000);
@@ -72,7 +74,7 @@ public class TimeSortTest extends Cleanu
             RowMutation rm = new RowMutation("Keyspace1", ByteBuffer.wrap(Integer.toString(i).getBytes()));
             for (int j = 0; j < 8; ++j)
             {
-                rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2)), ByteBuffer.wrap("a".getBytes()), j * 2);
+                rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2)), ByteBufferUtil.bytes("a"), j * 2);
             }
             rm.apply();
         }
@@ -87,13 +89,13 @@ public class TimeSortTest extends Cleanu
         RowMutation rm = new RowMutation("Keyspace1", key.key);
         for (int j = 0; j < 4; ++j)
         {
-            rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2 + 1)), ByteBuffer.wrap("b".getBytes()), j * 2 + 1);
+            rm.add(new QueryPath("StandardLong1", null, getBytes(j * 2 + 1)), ByteBufferUtil.bytes("b"), j * 2 + 1);
         }
         rm.apply();
         // and some overwrites
         rm = new RowMutation("Keyspace1", key.key);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), ByteBuffer.wrap("c".getBytes()), 100);
-        rm.add(new QueryPath("StandardLong1", null, getBytes(10)), ByteBuffer.wrap("c".getBytes()), 100);
+        rm.add(new QueryPath("StandardLong1", null, getBytes(0)), ByteBufferUtil.bytes("c"), 100);
+        rm.add(new QueryPath("StandardLong1", null, getBytes(10)), ByteBufferUtil.bytes("c"), 100);
         rm.apply();
 
         // verify

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/db/marshal/TypeCompareTest.java Tue Oct 26 03:14:08 2010
@@ -39,38 +39,38 @@ public class TypeCompareTest
     public void testAscii()
     {
         AsciiType comparator = new AsciiType();
-        assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, ByteBuffer.wrap("asdf".getBytes())) < 0;
-        assert comparator.compare(ByteBuffer.wrap("asdf".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER) > 0;
+        assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, ByteBufferUtil.bytes("asdf")) < 0;
+        assert comparator.compare(ByteBufferUtil.bytes("asdf"), FBUtilities.EMPTY_BYTE_BUFFER) > 0;
         assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER) == 0;
-        assert comparator.compare(ByteBuffer.wrap("z".getBytes()), ByteBuffer.wrap("a".getBytes())) > 0;
-        assert comparator.compare(ByteBuffer.wrap("a".getBytes()), ByteBuffer.wrap("z".getBytes())) < 0;
-        assert comparator.compare(ByteBuffer.wrap("asdf".getBytes()), ByteBuffer.wrap("asdf".getBytes())) == 0;
-        assert comparator.compare(ByteBuffer.wrap("asdz".getBytes()), ByteBuffer.wrap("asdf".getBytes())) > 0;
+        assert comparator.compare(ByteBufferUtil.bytes("z"), ByteBufferUtil.bytes("a")) > 0;
+        assert comparator.compare(ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("z")) < 0;
+        assert comparator.compare(ByteBufferUtil.bytes("asdf"), ByteBufferUtil.bytes("asdf")) == 0;
+        assert comparator.compare(ByteBufferUtil.bytes("asdz"), ByteBufferUtil.bytes("asdf")) > 0;
     }
 
     @Test
     public void testBytes()
     {
         BytesType comparator = new BytesType();
-        assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, ByteBuffer.wrap("asdf".getBytes())) < 0;
-        assert comparator.compare(ByteBuffer.wrap("asdf".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER) > 0;
+        assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, ByteBufferUtil.bytes("asdf")) < 0;
+        assert comparator.compare(ByteBufferUtil.bytes("asdf"), FBUtilities.EMPTY_BYTE_BUFFER) > 0;
         assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER) == 0;
-        assert comparator.compare(ByteBuffer.wrap("z".getBytes()), ByteBuffer.wrap("a".getBytes())) > 0;
-        assert comparator.compare(ByteBuffer.wrap("a".getBytes()), ByteBuffer.wrap("z".getBytes())) < 0;
-        assert comparator.compare(ByteBuffer.wrap("asdf".getBytes()), ByteBuffer.wrap("asdf".getBytes())) == 0;
-        assert comparator.compare(ByteBuffer.wrap("asdz".getBytes()), ByteBuffer.wrap("asdf".getBytes())) > 0;
+        assert comparator.compare(ByteBufferUtil.bytes("z"), ByteBufferUtil.bytes("a")) > 0;
+        assert comparator.compare(ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("z")) < 0;
+        assert comparator.compare(ByteBufferUtil.bytes("asdf"), ByteBufferUtil.bytes("asdf")) == 0;
+        assert comparator.compare(ByteBufferUtil.bytes("asdz"), ByteBufferUtil.bytes("asdf")) > 0;
     }
 
     @Test
     public void testUTF8()
     {
         UTF8Type comparator = new UTF8Type();
-        assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, ByteBuffer.wrap("asdf".getBytes())) < 0;
-        assert comparator.compare(ByteBuffer.wrap("asdf".getBytes()), FBUtilities.EMPTY_BYTE_BUFFER) > 0;
+        assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, ByteBufferUtil.bytes("asdf")) < 0;
+        assert comparator.compare(ByteBufferUtil.bytes("asdf"), FBUtilities.EMPTY_BYTE_BUFFER) > 0;
         assert comparator.compare(FBUtilities.EMPTY_BYTE_BUFFER, FBUtilities.EMPTY_BYTE_BUFFER) == 0;
-        assert comparator.compare(ByteBuffer.wrap("z".getBytes(Charsets.UTF_8)), ByteBuffer.wrap("a".getBytes(Charsets.UTF_8))) > 0;
-        assert comparator.compare(ByteBuffer.wrap("z".getBytes(Charsets.UTF_8)), ByteBuffer.wrap("z".getBytes(Charsets.UTF_8))) == 0;
-        assert comparator.compare(ByteBuffer.wrap("a".getBytes(Charsets.UTF_8)), ByteBuffer.wrap("z".getBytes(Charsets.UTF_8))) < 0;
+        assert comparator.compare(ByteBufferUtil.bytes("z"), ByteBufferUtil.bytes("a")) > 0;
+        assert comparator.compare(ByteBufferUtil.bytes("z"), ByteBufferUtil.bytes("z")) == 0;
+        assert comparator.compare(ByteBufferUtil.bytes("a"), ByteBufferUtil.bytes("z")) < 0;
     }
 
     @Test

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/LazilyCompactedRowTest.java Tue Oct 26 03:14:08 2010
@@ -43,6 +43,7 @@ import org.apache.cassandra.db.filter.Qu
 import org.apache.cassandra.io.sstable.IndexHelper;
 import org.apache.cassandra.io.sstable.SSTableReader;
 import org.apache.cassandra.io.util.DataOutputBuffer;
+import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.junit.Test;
 
@@ -121,9 +122,9 @@ public class LazilyCompactedRowTest exte
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
 
-        ByteBuffer key = ByteBuffer.wrap("k".getBytes());
+        ByteBuffer key = ByteBufferUtil.bytes("k");
         RowMutation rm = new RowMutation("Keyspace1", key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("c".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         rm.apply();
         cfs.forceBlockingFlush();
 
@@ -140,8 +141,8 @@ public class LazilyCompactedRowTest exte
 
         ByteBuffer key =ByteBuffer.wrap( "k".getBytes() );
         RowMutation rm = new RowMutation("Keyspace1", key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("c".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("d".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), FBUtilities.EMPTY_BYTE_BUFFER, 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("d")), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         rm.apply();
         cfs.forceBlockingFlush();
 
@@ -156,9 +157,9 @@ public class LazilyCompactedRowTest exte
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
 
-        ByteBuffer key = ByteBuffer.wrap("k".getBytes());
+        ByteBuffer key = ByteBufferUtil.bytes("k");
         RowMutation rm = new RowMutation("Keyspace1", key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("c".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         rm.apply();
         cfs.forceBlockingFlush();
 
@@ -176,10 +177,10 @@ public class LazilyCompactedRowTest exte
         Table table = Table.open("Keyspace1");
         ColumnFamilyStore cfs = table.getColumnFamilyStore("Standard1");
 
-        ByteBuffer key = ByteBuffer.wrap("k".getBytes());
+        ByteBuffer key = ByteBufferUtil.bytes("k");
         RowMutation rm = new RowMutation("Keyspace1", key);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("c".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
-        rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("d".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("c")), FBUtilities.EMPTY_BYTE_BUFFER, 0);
+        rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("d")), FBUtilities.EMPTY_BYTE_BUFFER, 0);
         rm.apply();
         cfs.forceBlockingFlush();
 

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableReaderTest.java Tue Oct 26 03:14:08 2010
@@ -38,6 +38,7 @@ import org.apache.cassandra.dht.Token;
 import org.apache.cassandra.io.util.FileDataInput;
 import org.apache.cassandra.io.util.MmappedSegmentedFile;
 import org.apache.cassandra.service.StorageService;
+import org.apache.cassandra.utils.ByteBufferUtil;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.Pair;
 
@@ -64,7 +65,7 @@ public class SSTableReaderTest extends C
         {
             ByteBuffer key = ByteBuffer.wrap(String.valueOf(j).getBytes());
             RowMutation rm = new RowMutation("Keyspace1", key);
-            rm.add(new QueryPath("Standard2", null, ByteBuffer.wrap("0".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, j);
+            rm.add(new QueryPath("Standard2", null, ByteBufferUtil.bytes("0")), FBUtilities.EMPTY_BYTE_BUFFER, j);
             rm.apply();
         }
         store.forceBlockingFlush();
@@ -105,7 +106,7 @@ public class SSTableReaderTest extends C
         {
             ByteBuffer key = ByteBuffer.wrap(String.valueOf(j).getBytes());
             RowMutation rm = new RowMutation("Keyspace1", key);
-            rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("0".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, j);
+            rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("0")), FBUtilities.EMPTY_BYTE_BUFFER, j);
             rm.apply();
         }
         store.forceBlockingFlush();
@@ -142,7 +143,7 @@ public class SSTableReaderTest extends C
         {
             ByteBuffer key = ByteBuffer.wrap(String.valueOf(j).getBytes());
             RowMutation rm = new RowMutation("Keyspace1", key);
-            rm.add(new QueryPath("Standard1", null, ByteBuffer.wrap("0".getBytes())), FBUtilities.EMPTY_BYTE_BUFFER, j);
+            rm.add(new QueryPath("Standard1", null, ByteBufferUtil.bytes("0")), FBUtilities.EMPTY_BYTE_BUFFER, j);
             rm.apply();
         }
         store.forceBlockingFlush();

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/io/sstable/SSTableWriterTest.java Tue Oct 26 03:14:08 2010
@@ -46,6 +46,7 @@ import org.apache.cassandra.thrift.Index
 import org.apache.cassandra.thrift.IndexOperator;
 import org.apache.cassandra.utils.FBUtilities;
 import org.junit.Test;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 public class SSTableWriterTest extends CleanupHelper {
 
@@ -54,25 +55,25 @@ public class SSTableWriterTest extends C
     {
         RowMutation rm;
 
-        rm = new RowMutation("Keyspace1", ByteBuffer.wrap("k1".getBytes()));
-        rm.add(new QueryPath("Indexed1", null, ByteBuffer.wrap("birthdate".getBytes("UTF8"))), FBUtilities.toByteBuffer(1L), 0);
+        rm = new RowMutation("Keyspace1", ByteBufferUtil.bytes("k1"));
+        rm.add(new QueryPath("Indexed1", null, ByteBufferUtil.bytes("birthdate")), FBUtilities.toByteBuffer(1L), 0);
         rm.apply();
         
         ColumnFamily cf = ColumnFamily.create("Keyspace1", "Indexed1");        
-        cf.addColumn(new Column(ByteBuffer.wrap("birthdate".getBytes()), FBUtilities.toByteBuffer(1L), 0));
-        cf.addColumn(new Column(ByteBuffer.wrap("anydate".getBytes()), FBUtilities.toByteBuffer(1L), 0));
+        cf.addColumn(new Column(ByteBufferUtil.bytes("birthdate"), FBUtilities.toByteBuffer(1L), 0));
+        cf.addColumn(new Column(ByteBufferUtil.bytes("anydate"), FBUtilities.toByteBuffer(1L), 0));
         
         Map<ByteBuffer, ByteBuffer> entries = new HashMap<ByteBuffer, ByteBuffer>();
         
         DataOutputBuffer buffer = new DataOutputBuffer();
         ColumnFamily.serializer().serializeWithIndexes(cf, buffer);
-        entries.put(ByteBuffer.wrap("k2".getBytes()), ByteBuffer.wrap(Arrays.copyOf(buffer.getData(), buffer.getLength())));        
+        entries.put(ByteBufferUtil.bytes("k2"), ByteBuffer.wrap(Arrays.copyOf(buffer.getData(), buffer.getLength())));        
         cf.clear();
         
-        cf.addColumn(new Column(ByteBuffer.wrap("anydate".getBytes()), FBUtilities.toByteBuffer(1L), 0));
+        cf.addColumn(new Column(ByteBufferUtil.bytes("anydate"), FBUtilities.toByteBuffer(1L), 0));
         buffer = new DataOutputBuffer();
         ColumnFamily.serializer().serializeWithIndexes(cf, buffer);               
-        entries.put(ByteBuffer.wrap("k3".getBytes()), ByteBuffer.wrap(Arrays.copyOf(buffer.getData(), buffer.getLength())));
+        entries.put(ByteBufferUtil.bytes("k3"), ByteBuffer.wrap(Arrays.copyOf(buffer.getData(), buffer.getLength())));
         
         SSTableReader orig = SSTableUtils.writeRawSSTable("Keyspace1", "Indexed1", entries);        
         // whack the index to trigger the recover
@@ -84,7 +85,7 @@ public class SSTableWriterTest extends C
         cfs.addSSTable(sstr);
         cfs.buildSecondaryIndexes(cfs.getSSTables(), cfs.getIndexedColumns());
         
-        IndexExpression expr = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteBuffer(1L));
+        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, FBUtilities.toByteBuffer(1L));
         IndexClause clause = new IndexClause(Arrays.asList(expr), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         IFilter filter = new IdentityQueryFilter();
         IPartitioner p = StorageService.getPartitioner();
@@ -92,6 +93,6 @@ public class SSTableWriterTest extends C
         List<Row> rows = cfs.scan(clause, range, filter);
         
         assertEquals("IndexExpression should return two rows on recoverAndOpen", 2, rows.size());
-        assertTrue("First result should be 'k1'",ByteBuffer.wrap("k1".getBytes()).equals(rows.get(0).key.key));
+        assertTrue("First result should be 'k1'",ByteBufferUtil.bytes("k1").equals(rows.get(0).key.key));
     }
 }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/AntiEntropyServiceTest.java Tue Oct 26 03:14:08 2010
@@ -51,6 +51,7 @@ import static com.google.common.base.Cha
 import static org.apache.cassandra.service.AntiEntropyService.*;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 public class AntiEntropyServiceTest extends CleanupHelper
 {
@@ -103,8 +104,8 @@ public class AntiEntropyServiceTest exte
         // write
         List<RowMutation> rms = new LinkedList<RowMutation>();
         RowMutation rm;
-        rm = new RowMutation(tablename, ByteBuffer.wrap("key1".getBytes()));
-        rm.add(new QueryPath(cfname, null, ByteBuffer.wrap("Column1".getBytes())), ByteBuffer.wrap("asdf".getBytes()), 0);
+        rm = new RowMutation(tablename, ByteBufferUtil.bytes("key1"));
+        rm.add(new QueryPath(cfname, null, ByteBufferUtil.bytes("Column1")), ByteBufferUtil.bytes("asdf"), 0);
         rms.add(rm);
         Util.writeColumnFamily(rms);
 
@@ -138,11 +139,11 @@ public class AntiEntropyServiceTest exte
         validator.prepare(store);
 
         // add a row with the minimum token
-        validator.add(new PrecompactedRow(new DecoratedKey(min, ByteBuffer.wrap("nonsense!".getBytes(UTF_8))),
+        validator.add(new PrecompactedRow(new DecoratedKey(min, ByteBufferUtil.bytes("nonsense!")),
                                        new DataOutputBuffer()));
 
         // and a row after it
-        validator.add(new PrecompactedRow(new DecoratedKey(mid, ByteBuffer.wrap("inconceivable!".getBytes(UTF_8))),
+        validator.add(new PrecompactedRow(new DecoratedKey(mid, ByteBufferUtil.bytes("inconceivable!")),
                                        new DataOutputBuffer()));
         validator.complete();
 

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/service/EmbeddedCassandraServiceTest.java Tue Oct 26 03:14:08 2010
@@ -40,6 +40,7 @@ import org.apache.thrift.transport.TTran
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 /**
  * Example how to use an embedded cassandra service.
@@ -89,15 +90,15 @@ public class EmbeddedCassandraServiceTes
         Cassandra.Client client = getClient();
         client.set_keyspace("Keyspace1");
 
-        ByteBuffer key_user_id = ByteBuffer.wrap("1".getBytes());
+        ByteBuffer key_user_id = ByteBufferUtil.bytes("1");
         
         long timestamp = System.currentTimeMillis();
         ColumnPath cp = new ColumnPath("Standard1");
         ColumnParent par = new ColumnParent("Standard1");
-        cp.column = ByteBuffer.wrap("name".getBytes(Charsets.UTF_8));
+        cp.column = ByteBufferUtil.bytes("name");
 
         // insert
-        client.insert(key_user_id, par, new Column(ByteBuffer.wrap("name".getBytes(Charsets.UTF_8)),
+        client.insert(key_user_id, par, new Column(ByteBufferUtil.bytes("name"),
                 ByteBuffer.wrap( "Ran".getBytes(Charsets.UTF_8)), timestamp), ConsistencyLevel.ONE);
 
         // read

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/streaming/StreamingTransferTest.java Tue Oct 26 03:14:08 2010
@@ -45,6 +45,7 @@ import org.apache.cassandra.utils.FBUtil
 
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 public class StreamingTransferTest extends CleanupHelper
 {
@@ -69,7 +70,7 @@ public class StreamingTransferTest exten
             RowMutation rm = new RowMutation("Keyspace1", ByteBuffer.wrap(key.getBytes()));
             ColumnFamily cf = ColumnFamily.create(table.name, cfs.columnFamily);
             cf.addColumn(column(key, "v", 0));
-            cf.addColumn(new Column(ByteBuffer.wrap("birthdate".getBytes("UTF8")), FBUtilities.toByteBuffer((long) i), 0));
+            cf.addColumn(new Column(ByteBufferUtil.bytes("birthdate"), FBUtilities.toByteBuffer((long) i), 0));
             rm.add(cf);
             rm.apply();
         }
@@ -81,8 +82,8 @@ public class StreamingTransferTest exten
         // transfer the first and last key
         IPartitioner p = StorageService.getPartitioner();
         List<Range> ranges = new ArrayList<Range>();
-        ranges.add(new Range(p.getMinimumToken(), p.getToken(ByteBuffer.wrap("key1".getBytes()))));
-        ranges.add(new Range(p.getToken(ByteBuffer.wrap("key2".getBytes())), p.getMinimumToken()));
+        ranges.add(new Range(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("key1"))));
+        ranges.add(new Range(p.getToken(ByteBufferUtil.bytes("key2")), p.getMinimumToken()));
         StreamOutSession session = StreamOutSession.create(table.name, LOCAL, null);
         StreamOut.transferSSTables(session, Arrays.asList(sstable), ranges);
         session.await();
@@ -90,24 +91,24 @@ public class StreamingTransferTest exten
         // confirm that the SSTable was transferred and registered
         List<Row> rows = Util.getRangeSlice(cfs);
         assertEquals(2, rows.size());
-        assert rows.get(0).key.key.equals( ByteBuffer.wrap("key1".getBytes()));
-        assert rows.get(1).key.key.equals( ByteBuffer.wrap("key3".getBytes()));
+        assert rows.get(0).key.key.equals( ByteBufferUtil.bytes("key1"));
+        assert rows.get(1).key.key.equals( ByteBufferUtil.bytes("key3"));
         assertEquals(2, rows.get(0).cf.getColumnsMap().size());
         assertEquals(2, rows.get(1).cf.getColumnsMap().size());
-        assert rows.get(1).cf.getColumn(ByteBuffer.wrap("key3".getBytes())) != null;
+        assert rows.get(1).cf.getColumn(ByteBufferUtil.bytes("key3")) != null;
 
         // and that the index and filter were properly recovered
         assert null != cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("key1"), new QueryPath(cfs.columnFamily)));
         assert null != cfs.getColumnFamily(QueryFilter.getIdentityFilter(Util.dk("key3"), new QueryPath(cfs.columnFamily)));
 
         // and that the secondary index works
-        IndexExpression expr = new IndexExpression(ByteBuffer.wrap("birthdate".getBytes("UTF8")), IndexOperator.EQ, FBUtilities.toByteBuffer(3L));
+        IndexExpression expr = new IndexExpression(ByteBufferUtil.bytes("birthdate"), IndexOperator.EQ, FBUtilities.toByteBuffer(3L));
         IndexClause clause = new IndexClause(Arrays.asList(expr), FBUtilities.EMPTY_BYTE_BUFFER, 100);
         IFilter filter = new IdentityQueryFilter();
         Range range = new Range(p.getMinimumToken(), p.getMinimumToken());
         rows = cfs.scan(clause, range, filter);
         assertEquals(1, rows.size());
-        assert rows.get(0).key.key.equals( ByteBuffer.wrap("key3".getBytes())) ;
+        assert rows.get(0).key.key.equals( ByteBufferUtil.bytes("key3")) ;
     }
 
     @Test
@@ -131,8 +132,8 @@ public class StreamingTransferTest exten
         // transfer the first and last key
         IPartitioner p = StorageService.getPartitioner();
         List<Range> ranges = new ArrayList<Range>();
-        ranges.add(new Range(p.getMinimumToken(), p.getToken(ByteBuffer.wrap("transfer1".getBytes()))));
-        ranges.add(new Range(p.getToken(ByteBuffer.wrap("test2".getBytes())), p.getMinimumToken()));
+        ranges.add(new Range(p.getMinimumToken(), p.getToken(ByteBufferUtil.bytes("transfer1"))));
+        ranges.add(new Range(p.getToken(ByteBufferUtil.bytes("test2")), p.getMinimumToken()));
         StreamOutSession session = StreamOutSession.create(tablename, LOCAL, null);
         StreamOut.transferSSTables(session, Arrays.asList(sstable, sstable2), ranges);
         session.await();
@@ -141,7 +142,7 @@ public class StreamingTransferTest exten
         ColumnFamilyStore cfstore = Table.open(tablename).getColumnFamilyStore(cfname);
         List<Row> rows = Util.getRangeSlice(cfstore);
         assertEquals(6, rows.size());
-        assert rows.get(0).key.key.equals( ByteBuffer.wrap("test".getBytes()));
+        assert rows.get(0).key.key.equals( ByteBufferUtil.bytes("test"));
         assert rows.get(3).key.key.equals(ByteBuffer.wrap( "transfer1".getBytes() ));
         assert rows.get(0).cf.getColumnsMap().size() == 1;
         assert rows.get(3).cf.getColumnsMap().size() == 1;

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableExportTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableExportTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableExportTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableExportTest.java Tue Oct 26 03:14:08 2010
@@ -47,6 +47,7 @@ import org.json.simple.JSONObject;
 import org.json.simple.JSONValue;
 import org.json.simple.parser.ParseException;
 import org.junit.Test;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 public class SSTableExportTest extends SchemaLoader
 {
@@ -63,12 +64,12 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Standard1", null, ByteBuffer.wrap("colA".getBytes())), ByteBuffer.wrap("valA".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), 1);
         writer.append(Util.dk("rowA"), cfamily);
         cfamily.clear();
         
         // Add rowB
-        cfamily.addColumn(new QueryPath("Standard1", null, ByteBuffer.wrap("colB".getBytes())), ByteBuffer.wrap("valB".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), 1);
         writer.append(Util.dk("rowB"), cfamily);
         cfamily.clear();
      
@@ -95,17 +96,17 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Standard1", null, ByteBuffer.wrap("colA".getBytes())), ByteBuffer.wrap("valA".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), 1);
         writer.append(Util.dk("rowA"), cfamily);
         cfamily.clear();
         
         // Add rowB
-        cfamily.addColumn(new QueryPath("Standard1", null, ByteBuffer.wrap("colB".getBytes())), ByteBuffer.wrap("valB".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), 1);
         writer.append(Util.dk("rowB"), cfamily);
         cfamily.clear();
 
         // Add rowExclude
-        cfamily.addColumn(new QueryPath("Standard1", null, ByteBuffer.wrap("colX".getBytes())), ByteBuffer.wrap("valX".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("colX")), ByteBufferUtil.bytes("valX"), 1);
         writer.append(Util.dk("rowExclude"), cfamily);
         cfamily.clear();
 
@@ -137,17 +138,17 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Super4", ByteBuffer.wrap("superA".getBytes()), ByteBuffer.wrap("colA".getBytes())), ByteBuffer.wrap("valA".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superA"), ByteBufferUtil.bytes("colA")), ByteBufferUtil.bytes("valA"), 1);
         writer.append(Util.dk("rowA"), cfamily);
         cfamily.clear();
         
         // Add rowB
-        cfamily.addColumn(new QueryPath("Super4", ByteBuffer.wrap("superB".getBytes()), ByteBuffer.wrap("colB".getBytes())), ByteBuffer.wrap("valB".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superB"), ByteBufferUtil.bytes("colB")), ByteBufferUtil.bytes("valB"), 1);
         writer.append(Util.dk("rowB"), cfamily);
         cfamily.clear();
 
         // Add rowExclude
-        cfamily.addColumn(new QueryPath("Super4", ByteBuffer.wrap("superX".getBytes()), ByteBuffer.wrap("colX".getBytes())), ByteBuffer.wrap("valX".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Super4", ByteBufferUtil.bytes("superX"), ByteBufferUtil.bytes("colX")), ByteBufferUtil.bytes("valX"), 1);
         writer.append(Util.dk("rowExclude"), cfamily);
         cfamily.clear();
 
@@ -160,7 +161,7 @@ public class SSTableExportTest extends S
         JSONObject json = (JSONObject)JSONValue.parse(new FileReader(tempJson));
         
         JSONObject rowA = (JSONObject)json.get(asHex("rowA"));
-        JSONObject superA = (JSONObject)rowA.get(cfamily.getComparator().getString(ByteBuffer.wrap("superA".getBytes())));
+        JSONObject superA = (JSONObject)rowA.get(cfamily.getComparator().getString(ByteBufferUtil.bytes("superA")));
         JSONArray subColumns = (JSONArray)superA.get("subColumns");
         JSONArray colA = (JSONArray)subColumns.get(0);
         JSONObject rowExclude = (JSONObject)json.get(asHex("rowExclude"));
@@ -177,12 +178,12 @@ public class SSTableExportTest extends S
         SSTableWriter writer = new SSTableWriter(tempSS.getPath(), 2);
         
         // Add rowA
-        cfamily.addColumn(new QueryPath("Standard1", null, ByteBuffer.wrap("name".getBytes())), ByteBuffer.wrap("val".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("name")), ByteBufferUtil.bytes("val"), 1);
         writer.append(Util.dk("rowA"), cfamily);
         cfamily.clear();
 
         // Add rowExclude
-        cfamily.addColumn(new QueryPath("Standard1", null, ByteBuffer.wrap("name".getBytes())), ByteBuffer.wrap("val".getBytes()), 1);
+        cfamily.addColumn(new QueryPath("Standard1", null, ByteBufferUtil.bytes("name")), ByteBufferUtil.bytes("val"), 1);
         writer.append(Util.dk("rowExclude"), cfamily);
         cfamily.clear();
 
@@ -197,12 +198,12 @@ public class SSTableExportTest extends S
         SSTableImport.importJson(tempJson.getPath(), "Keyspace1", "Standard1", tempSS2.getPath());
 
         reader = SSTableReader.open(Descriptor.fromFilename(tempSS2.getPath()));
-        QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Standard1", null, null), ByteBuffer.wrap("name".getBytes()));
+        QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Standard1", null, null), ByteBufferUtil.bytes("name"));
         ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
         assertTrue(cf != null);
-        assertTrue(cf.getColumn(ByteBuffer.wrap("name".getBytes())).value().equals(ByteBuffer.wrap(hexToBytes("76616c"))));
+        assertTrue(cf.getColumn(ByteBufferUtil.bytes("name")).value().equals(ByteBuffer.wrap(hexToBytes("76616c"))));
 
-        qf = QueryFilter.getNamesFilter(Util.dk("rowExclude"), new QueryPath("Standard1", null, null), ByteBuffer.wrap("name".getBytes()));
+        qf = QueryFilter.getNamesFilter(Util.dk("rowExclude"), new QueryPath("Standard1", null, null), ByteBufferUtil.bytes("name"));
         cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
         assert cf == null;
     }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableImportTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableImportTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableImportTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/tools/SSTableImportTest.java Tue Oct 26 03:14:08 2010
@@ -38,6 +38,7 @@ import org.apache.cassandra.Util;
 
 import org.json.simple.parser.ParseException;
 import org.junit.Test;
+import org.apache.cassandra.utils.ByteBufferUtil;
 
 public class SSTableImportTest extends SchemaLoader
 {   
@@ -51,9 +52,9 @@ public class SSTableImportTest extends S
 
         // Verify results
         SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
-        QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Standard1", null, null), ByteBuffer.wrap("colAA".getBytes()));
+        QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Standard1", null, null), ByteBufferUtil.bytes("colAA"));
         ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
-        assert cf.getColumn(ByteBuffer.wrap("colAA".getBytes())).value().equals(ByteBuffer.wrap(hexToBytes("76616c4141")));
+        assert cf.getColumn(ByteBufferUtil.bytes("colAA")).value().equals(ByteBuffer.wrap(hexToBytes("76616c4141")));
     }
 
     @Test
@@ -65,9 +66,9 @@ public class SSTableImportTest extends S
         
         // Verify results
         SSTableReader reader = SSTableReader.open(Descriptor.fromFilename(tempSS.getPath()));
-        QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Super4", null, null), ByteBuffer.wrap("superA".getBytes()));
+        QueryFilter qf = QueryFilter.getNamesFilter(Util.dk("rowA"), new QueryPath("Super4", null, null), ByteBufferUtil.bytes("superA"));
         ColumnFamily cf = qf.getSSTableColumnIterator(reader).getColumnFamily();
-        IColumn superCol = cf.getColumn(ByteBuffer.wrap("superA".getBytes()));
-        assert superCol.getSubColumn(ByteBuffer.wrap("colAA".getBytes())).value().equals(ByteBuffer.wrap(hexToBytes("76616c75654141")));
+        IColumn superCol = cf.getColumn(ByteBufferUtil.bytes("superA"));
+        assert superCol.getSubColumn(ByteBufferUtil.bytes("colAA")).value().equals(ByteBuffer.wrap(hexToBytes("76616c75654141")));
     }
 }

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/BloomFilterTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/BloomFilterTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/BloomFilterTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/BloomFilterTest.java Tue Oct 26 03:14:08 2010
@@ -55,9 +55,9 @@ public class BloomFilterTest
     @Test
     public void testOne()
     {
-        bf.add(ByteBuffer.wrap("a".getBytes()));
-        assert bf.isPresent(ByteBuffer.wrap("a".getBytes()));
-        assert !bf.isPresent(ByteBuffer.wrap("b".getBytes()));
+        bf.add(ByteBufferUtil.bytes("a"));
+        assert bf.isPresent(ByteBufferUtil.bytes("a"));
+        assert !bf.isPresent(ByteBufferUtil.bytes("b"));
     }
 
     @Test

Modified: cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/FilterTest.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/FilterTest.java?rev=1027349&r1=1027348&r2=1027349&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/FilterTest.java (original)
+++ cassandra/branches/cassandra-0.7/test/unit/org/apache/cassandra/utils/FilterTest.java Tue Oct 26 03:14:08 2010
@@ -99,15 +99,15 @@ public class FilterTest
 
     public static Filter testSerialize(Filter f) throws IOException
     {
-        f.add(ByteBuffer.wrap("a".getBytes()));
+        f.add(ByteBufferUtil.bytes("a"));
         DataOutputBuffer out = new DataOutputBuffer();
         f.getSerializer().serialize(f, out);
 
         ByteArrayInputStream in = new ByteArrayInputStream(out.getData(), 0, out.getLength());
         Filter f2 = f.getSerializer().deserialize(new DataInputStream(in));
 
-        assert f2.isPresent(ByteBuffer.wrap("a".getBytes()));
-        assert !f2.isPresent(ByteBuffer.wrap("b".getBytes()));
+        assert f2.isPresent(ByteBufferUtil.bytes("a"));
+        assert !f2.isPresent(ByteBufferUtil.bytes("b"));
         return f2;
     }