You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by ja...@apache.org on 2014/08/12 16:59:00 UTC

git commit: fix cl unit tests

Repository: cassandra
Updated Branches:
  refs/heads/trunk 78142080d -> f774b2a93


fix cl unit tests


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/f774b2a9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/f774b2a9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/f774b2a9

Branch: refs/heads/trunk
Commit: f774b2a931949c2fc1485733fdc88ab674db870e
Parents: 7814208
Author: Jake Luciani <ja...@apache.org>
Authored: Tue Aug 12 10:58:29 2014 -0400
Committer: Jake Luciani <ja...@apache.org>
Committed: Tue Aug 12 10:58:50 2014 -0400

----------------------------------------------------------------------
 .../org/apache/cassandra/db/CommitLogTest.java  | 24 +++++++++++++-------
 1 file changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/f774b2a9/test/unit/org/apache/cassandra/db/CommitLogTest.java
----------------------------------------------------------------------
diff --git a/test/unit/org/apache/cassandra/db/CommitLogTest.java b/test/unit/org/apache/cassandra/db/CommitLogTest.java
index fba86f6..1383d78 100644
--- a/test/unit/org/apache/cassandra/db/CommitLogTest.java
+++ b/test/unit/org/apache/cassandra/db/CommitLogTest.java
@@ -56,6 +56,7 @@ import static org.apache.cassandra.utils.ByteBufferUtil.bytes;
 public class CommitLogTest
 {
     private static final String KEYSPACE1 = "CommitLogTest";
+    private static final String KEYSPACE2 = "CommitLogTestNonDurable";
     private static final String CF1 = "Standard1";
     private static final String CF2 = "Standard2";
 
@@ -68,6 +69,13 @@ public class CommitLogTest
                                     KSMetaData.optsWithRF(1),
                                     SchemaLoader.standardCFMD(KEYSPACE1, CF1),
                                     SchemaLoader.standardCFMD(KEYSPACE1, CF2));
+        SchemaLoader.createKeyspace(KEYSPACE2,
+                                    false,
+                                    true,
+                                    SimpleStrategy.class,
+                                    KSMetaData.optsWithRF(1),
+                                    SchemaLoader.standardCFMD(KEYSPACE1, CF1),
+                                    SchemaLoader.standardCFMD(KEYSPACE1, CF2));
         System.setProperty("cassandra.commitlog.stop_on_errors", "true");
     }
 
@@ -200,7 +208,7 @@ public class CommitLogTest
 
     private static int getMaxRecordDataSize(String keyspace, ByteBuffer key, String table, CellName column)
     {
-        Mutation rm = new Mutation("Keyspace1", bytes("k"));
+        Mutation rm = new Mutation(KEYSPACE1, bytes("k"));
         rm.add("Standard1", Util.cellname("c1"), ByteBuffer.allocate(0), 0);
 
         int max = (DatabaseDescriptor.getCommitLogSegmentSize() / 2);
@@ -327,15 +335,15 @@ public class CommitLogTest
         CommitLog.instance.resetUnsafe();
         boolean prev = DatabaseDescriptor.isAutoSnapshot();
         DatabaseDescriptor.setAutoSnapshot(false);
-        ColumnFamilyStore cfs1 = Keyspace.open("Keyspace1").getColumnFamilyStore("Standard1");
-        ColumnFamilyStore cfs2 = Keyspace.open("Keyspace1").getColumnFamilyStore("Standard2");
+        ColumnFamilyStore cfs1 = Keyspace.open(KEYSPACE1).getColumnFamilyStore("Standard1");
+        ColumnFamilyStore cfs2 = Keyspace.open(KEYSPACE1).getColumnFamilyStore("Standard2");
 
-        final Mutation rm1 = new Mutation("Keyspace1", bytes("k"));
+        final Mutation rm1 = new Mutation(KEYSPACE1, bytes("k"));
         rm1.add("Standard1", Util.cellname("c1"), ByteBuffer.allocate(100), 0);
         rm1.apply();
         cfs1.truncateBlocking();
         DatabaseDescriptor.setAutoSnapshot(prev);
-        final Mutation rm2 = new Mutation("Keyspace1", bytes("k"));
+        final Mutation rm2 = new Mutation(KEYSPACE1, bytes("k"));
         rm2.add("Standard2", Util.cellname("c1"), ByteBuffer.allocate(DatabaseDescriptor.getCommitLogSegmentSize() / 4), 0);
 
         for (int i = 0 ; i < 5 ; i++)
@@ -356,7 +364,7 @@ public class CommitLogTest
         CommitLog.instance.resetUnsafe();
         boolean prevAutoSnapshot = DatabaseDescriptor.isAutoSnapshot();
         DatabaseDescriptor.setAutoSnapshot(false);
-        Keyspace notDurableKs = Keyspace.open("NoCommitlogSpace");
+        Keyspace notDurableKs = Keyspace.open(KEYSPACE2);
         Assert.assertFalse(notDurableKs.metadata.durableWrites);
         ColumnFamilyStore cfs = notDurableKs.getColumnFamilyStore("Standard1");
         CellNameType type = notDurableKs.getColumnFamilyStore("Standard1").getComparator();
@@ -364,11 +372,11 @@ public class CommitLogTest
         DecoratedKey dk = Util.dk("key1");
 
         // add data
-        rm = new Mutation("NoCommitlogSpace", dk.getKey());
+        rm = new Mutation(KEYSPACE2, dk.getKey());
         rm.add("Standard1", Util.cellname("Column1"), ByteBufferUtil.bytes("abcd"), 0);
         rm.apply();
 
-        ReadCommand command = new SliceByNamesReadCommand("NoCommitlogSpace", dk.getKey(), "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
+        ReadCommand command = new SliceByNamesReadCommand(KEYSPACE2, dk.getKey(), "Standard1", System.currentTimeMillis(), new NamesQueryFilter(FBUtilities.singleton(Util.cellname("Column1"), type)));
         Row row = command.getRow(notDurableKs);
         Cell col = row.cf.getColumn(Util.cellname("Column1"));
         Assert.assertEquals(col.value(), ByteBuffer.wrap("abcd".getBytes()));