cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r765828 - /incubator/cassandra/trunk/test/org/apache/cassandra/db/ColumnFamilyStoreTest.java
Date Fri, 17 Apr 2009 01:48:32 GMT
Author: jbellis
Date: Fri Apr 17 01:48:31 2009
New Revision: 765828

URL: http://svn.apache.org/viewvc?rev=765828&view=rev
Log:
add testRemoveColumnFamily, testRemoveSubColumn.  (these do not pass yet b/c of
cleanup problems.)  patch by jbellis; reviewed by Sandeep Tata for #85

Modified:
    incubator/cassandra/trunk/test/org/apache/cassandra/db/ColumnFamilyStoreTest.java

Modified: incubator/cassandra/trunk/test/org/apache/cassandra/db/ColumnFamilyStoreTest.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/test/org/apache/cassandra/db/ColumnFamilyStoreTest.java?rev=765828&r1=765827&r2=765828&view=diff
==============================================================================
--- incubator/cassandra/trunk/test/org/apache/cassandra/db/ColumnFamilyStoreTest.java (original)
+++ incubator/cassandra/trunk/test/org/apache/cassandra/db/ColumnFamilyStoreTest.java Fri
Apr 17 01:48:31 2009
@@ -203,7 +203,7 @@
     }
 
     @Test
-    public void testRemove() throws IOException, ColumnFamilyNotDefinedException, ExecutionException,
InterruptedException
+    public void testRemoveColumn() throws IOException, ColumnFamilyNotDefinedException, ExecutionException,
InterruptedException
     {
         Table table = Table.open("Table1");
         ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
@@ -226,6 +226,29 @@
     }
 
     @Test
+    public void testRemoveSubColumn() throws IOException, ColumnFamilyNotDefinedException,
ExecutionException, InterruptedException
+    {
+        Table table = Table.open("Table1");
+        ColumnFamilyStore store = table.getColumnFamilyStore("Super1");
+        RowMutation rm;
+
+        // add data
+        rm = new RowMutation("Table1", "key1");
+        rm.add("Super1:SC1:Column1", "asdf".getBytes(), 0);
+        rm.apply();
+        store.forceFlush();
+        waitForFlush();
+
+        // remove
+        rm = new RowMutation("Table1", "key1");
+        rm.delete("Super1:SC1:Column1", 1);
+        rm.apply();
+
+        ColumnFamily retrieved = store.getColumnFamily("key1", "Super1:SC1", new IdentityFilter());
+        assert retrieved.getColumnCount() == 0;
+    }
+
+    @Test
     public void testRemoveSuperColumn() throws IOException, ColumnFamilyNotDefinedException,
ExecutionException, InterruptedException
     {
         Table table = Table.open("Table1");
@@ -256,6 +279,29 @@
     }
 
     @Test
+    public void testRemoveColumnFamily() throws IOException, ColumnFamilyNotDefinedException,
ExecutionException, InterruptedException
+    {
+        Table table = Table.open("Table1");
+        ColumnFamilyStore store = table.getColumnFamilyStore("Standard1");
+        RowMutation rm;
+
+        // add data
+        rm = new RowMutation("Table1", "key1");
+        rm.add("Standard1:Column1", "asdf".getBytes(), 0);
+        rm.add("Standard1:Column2", "asdf".getBytes(), 0);
+        rm.apply();
+        store.forceBlockingFlush();
+
+        // remove
+        rm = new RowMutation("Table1", "key1");
+        rm.delete("Standard1", 1);
+        rm.apply();
+
+        ColumnFamily retrieved = store.getColumnFamily("key1", "Standard1", new IdentityFilter());
+        assert retrieved.getColumnCount() == 0;
+    }
+
+    @Test
     public void testGetCompactionBuckets() throws IOException
     {
         // create files 20 40 60 ... 180



Mime
View raw message