Repository: cassandra Updated Branches: refs/heads/trunk 7659ae2ee -> 245759942
http://git-wip-us.apache.org/repos/asf/cassandra/blob/24575994/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java b/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java index 671ee9c..0f822c1 100644 --- a/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java +++ b/test/unit/org/apache/cassandra/io/sstable/SSTableRewriterTest.java @@ -249,17 +249,10 @@ public class SSTableRewriterTest extends SchemaLoader { for (int i = 0; i < 10000; i++) { - RowUpdateBuilder builder = new RowUpdateBuilder(cfs.metadata, 1, random(i, 10)); - - PartitionUpdate update = null; - + UpdateBuilder builder = UpdateBuilder.create(cfs.metadata, random(i, 10)).withTimestamp(1); for (int j = 0; j < 100; j++) - { - builder.clustering("" + j).add("val", ByteBuffer.allocate(1000)); - update = builder.buildUpdate(); - } - - writer.append(update.unfilteredIterator()); + builder.newRow("" + j).add("val", ByteBuffer.allocate(1000)); + writer.append(builder.build().unfilteredIterator()); } SSTableReader s = writer.setMaxDataAge(1000).openEarly(); @@ -267,17 +260,10 @@ public class SSTableRewriterTest extends SchemaLoader assertFileCounts(dir.list(), 2, 2); for (int i = 10000; i < 20000; i++) { - RowUpdateBuilder builder = new RowUpdateBuilder(cfs.metadata, 1, random(i, 10)); - - PartitionUpdate update = null; - + UpdateBuilder builder = UpdateBuilder.create(cfs.metadata, random(i, 10)).withTimestamp(1); for (int j = 0; j < 100; j++) - { - builder.clustering("" + j).add("val", ByteBuffer.allocate(1000)); - update = builder.buildUpdate(); - } - - writer.append(update.unfilteredIterator()); + builder.newRow("" + j).add("val", ByteBuffer.allocate(1000)); + writer.append(builder.build().unfilteredIterator()); } SSTableReader s2 = writer.setMaxDataAge(1000).openEarly(); assertTrue(s.last.compareTo(s2.last) < 0); http://git-wip-us.apache.org/repos/asf/cassandra/blob/24575994/test/unit/org/apache/cassandra/schema/DefsTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/schema/DefsTest.java b/test/unit/org/apache/cassandra/schema/DefsTest.java index cf49253..b567bb5 100644 --- a/test/unit/org/apache/cassandra/schema/DefsTest.java +++ b/test/unit/org/apache/cassandra/schema/DefsTest.java @@ -99,7 +99,7 @@ public class DefsTest for (int i = 0; i < 5; i++) { ByteBuffer name = ByteBuffer.wrap(new byte[] { (byte)i }); - cfm.addColumnDefinition(ColumnDefinition.regularDef(cfm, name, BytesType.instance, null).setIndex(Integer.toString(i), IndexType.KEYS, null)); + cfm.addColumnDefinition(ColumnDefinition.regularDef(cfm, name, BytesType.instance).setIndex(Integer.toString(i), IndexType.KEYS, null)); } cfm.comment("No comment") @@ -114,12 +114,12 @@ public class DefsTest CFMetaData cfNew = cfm.copy(); // add one. - ColumnDefinition addIndexDef = ColumnDefinition.regularDef(cfm, ByteBuffer.wrap(new byte[] { 5 }), BytesType.instance, null) + ColumnDefinition addIndexDef = ColumnDefinition.regularDef(cfm, ByteBuffer.wrap(new byte[] { 5 }), BytesType.instance) .setIndex("5", IndexType.KEYS, null); cfNew.addColumnDefinition(addIndexDef); // remove one. - ColumnDefinition removeIndexDef = ColumnDefinition.regularDef(cfm, ByteBuffer.wrap(new byte[] { 0 }), BytesType.instance, null) + ColumnDefinition removeIndexDef = ColumnDefinition.regularDef(cfm, ByteBuffer.wrap(new byte[] { 0 }), BytesType.instance) .setIndex("0", IndexType.KEYS, null); assertTrue(cfNew.removeColumnDefinition(removeIndexDef)); @@ -530,7 +530,7 @@ public class DefsTest // drop the index CFMetaData meta = cfs.metadata.copy(); ColumnDefinition cdOld = cfs.metadata.getColumnDefinition(ByteBufferUtil.bytes("birthdate")); - ColumnDefinition cdNew = ColumnDefinition.regularDef(meta, cdOld.name.bytes, cdOld.type, null); + ColumnDefinition cdNew = ColumnDefinition.regularDef(meta, cdOld.name.bytes, cdOld.type); meta.addOrReplaceColumnDefinition(cdNew); MigrationManager.announceColumnFamilyUpdate(meta, false); http://git-wip-us.apache.org/repos/asf/cassandra/blob/24575994/test/unit/org/apache/cassandra/service/DataResolverTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/service/DataResolverTest.java b/test/unit/org/apache/cassandra/service/DataResolverTest.java index d752539..dd57a96 100644 --- a/test/unit/org/apache/cassandra/service/DataResolverTest.java +++ b/test/unit/org/apache/cassandra/service/DataResolverTest.java @@ -360,7 +360,7 @@ public class DataResolverTest assertEquals(1, messageRecorder.sent.size()); MessageOut msg = getSentMessage(peer1); assertRepairMetadata(msg); - assertRepairContainsDeletions(msg, new SimpleDeletionTime(1, nowInSec)); + assertRepairContainsDeletions(msg, new DeletionTime(1, nowInSec)); assertRepairContainsNoColumns(msg); } @@ -397,19 +397,19 @@ public class DataResolverTest assertEquals(4, messageRecorder.sent.size()); MessageOut msg = getSentMessage(peer1); assertRepairMetadata(msg); - assertRepairContainsDeletions(msg, new SimpleDeletionTime(2, nowInSec)); + assertRepairContainsDeletions(msg, new DeletionTime(2, nowInSec)); assertRepairContainsColumn(msg, "1", "two", "B", 3); // peer 2 needs the deletion from peer 4 and the row from peer 3 msg = getSentMessage(peer2); assertRepairMetadata(msg); - assertRepairContainsDeletions(msg, new SimpleDeletionTime(2, nowInSec)); + assertRepairContainsDeletions(msg, new DeletionTime(2, nowInSec)); assertRepairContainsColumn(msg, "1", "two", "B", 3); // peer 3 needs just the deletion from peer 4 msg = getSentMessage(peer3); assertRepairMetadata(msg); - assertRepairContainsDeletions(msg, new SimpleDeletionTime(2, nowInSec)); + assertRepairContainsDeletions(msg, new DeletionTime(2, nowInSec)); assertRepairContainsNoColumns(msg); // peer 4 needs just the row from peer 3 @@ -500,7 +500,7 @@ public class DataResolverTest private RangeTombstone tombstone(Object start, Object end, long markedForDeleteAt, int localDeletionTime) { return new RangeTombstone(Slice.make(cfm.comparator.make(start), cfm.comparator.make(end)), - new SimpleDeletionTime(markedForDeleteAt, localDeletionTime)); + new DeletionTime(markedForDeleteAt, localDeletionTime)); } private UnfilteredPartitionIterator fullPartitionDelete(CFMetaData cfm, DecoratedKey dk, long timestamp, int nowInSec) http://git-wip-us.apache.org/repos/asf/cassandra/blob/24575994/test/unit/org/apache/cassandra/triggers/TriggerExecutorTest.java ---------------------------------------------------------------------- diff --git a/test/unit/org/apache/cassandra/triggers/TriggerExecutorTest.java b/test/unit/org/apache/cassandra/triggers/TriggerExecutorTest.java index 0cf7491..df4b08a 100644 --- a/test/unit/org/apache/cassandra/triggers/TriggerExecutorTest.java +++ b/test/unit/org/apache/cassandra/triggers/TriggerExecutorTest.java @@ -24,10 +24,7 @@ import org.junit.Test; import org.apache.cassandra.Util; import org.apache.cassandra.config.CFMetaData; import org.apache.cassandra.db.*; -import org.apache.cassandra.db.rows.UnfilteredRowIterators; -import org.apache.cassandra.db.rows.Cell; -import org.apache.cassandra.db.rows.Row; -import org.apache.cassandra.db.rows.RowIterator; +import org.apache.cassandra.db.rows.*; import org.apache.cassandra.db.marshal.UTF8Type; import org.apache.cassandra.db.partitions.Partition; import org.apache.cassandra.db.partitions.PartitionUpdate; @@ -51,7 +48,7 @@ public class TriggerExecutorTest RowIterator rowIterator = UnfilteredRowIterators.filter(mutated.unfilteredIterator(), FBUtilities.nowInSeconds()); - Iterator<Cell> cells = rowIterator.next().iterator(); + Iterator<Cell> cells = rowIterator.next().cells().iterator(); assertEquals(bytes("trigger"), cells.next().value()); assertTrue(!rowIterator.hasNext()); @@ -271,22 +268,15 @@ public class TriggerExecutorTest private static PartitionUpdate makeCf(CFMetaData metadata, String key, String columnValue1, String columnValue2) { - PartitionUpdate update = new PartitionUpdate(metadata, Util.dk(key), metadata.partitionColumns(), 1); - - LivenessInfo info = SimpleLivenessInfo.forUpdate(FBUtilities.timestampMicros(), LivenessInfo.NO_TTL, FBUtilities.nowInSeconds(), metadata); - + Row.Builder builder = ArrayBackedRow.unsortedBuilder(metadata.partitionColumns().regulars, FBUtilities.nowInSeconds()); + builder.newRow(Clustering.EMPTY); + long ts = FBUtilities.timestampMicros(); if (columnValue1 != null) - { - update.writer().writeCell(metadata.getColumnDefinition(bytes("c1")), false, bytes(columnValue1), info, null); - update.writer().endOfRow(); - } + builder.addCell(BufferCell.live(metadata, metadata.getColumnDefinition(bytes("c1")), ts, bytes(columnValue1))); if (columnValue2 != null) - { - update.writer().writeCell(metadata.getColumnDefinition(bytes("c2")), false, bytes(columnValue1), info, null); - update.writer().endOfRow(); - } + builder.addCell(BufferCell.live(metadata, metadata.getColumnDefinition(bytes("c2")), ts, bytes(columnValue2))); - return update; + return PartitionUpdate.singleRowUpdate(metadata, Util.dk(key), builder.build()); } public static class NoOpTrigger implements ITrigger