cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gdusba...@apache.org
Subject svn commit: r991609 - in /cassandra/trunk/test/system: avro_utils.py test_avro_server.py test_avro_standard.py test_avro_system.py
Date Wed, 01 Sep 2010 17:22:08 GMT
Author: gdusbabek
Date: Wed Sep  1 17:22:07 2010
New Revision: 991609

URL: http://svn.apache.org/viewvc?rev=991609&view=rev
Log:
move avro system tests, create avro_utils

Added:
    cassandra/trunk/test/system/avro_utils.py
Modified:
    cassandra/trunk/test/system/test_avro_server.py
    cassandra/trunk/test/system/test_avro_standard.py
    cassandra/trunk/test/system/test_avro_system.py

Added: cassandra/trunk/test/system/avro_utils.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/avro_utils.py?rev=991609&view=auto
==============================================================================
--- cassandra/trunk/test/system/avro_utils.py (added)
+++ cassandra/trunk/test/system/avro_utils.py Wed Sep  1 17:22:07 2010
@@ -0,0 +1,5 @@
+
+def assert_raises(excClass, func, *args, **kwargs):
+    try: r = func(*args, **kwargs)
+    except excClass: pass
+    else: raise Exception('expected %s; got %s' % (excClass.__name__, r))

Modified: cassandra/trunk/test/system/test_avro_server.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_avro_server.py?rev=991609&r1=991608&r2=991609&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_avro_server.py (original)
+++ cassandra/trunk/test/system/test_avro_server.py Wed Sep  1 17:22:07 2010
@@ -47,11 +47,6 @@ def assert_cosc(thing, with_supercolumn=
     assert thing.has_key(containing) and thing[containing].has_key('name'), \
             "Invalid or missing \"%s\" member" % containing
 
-def assert_raises(excClass, func, *args, **kwargs):
-    try: r = func(*args, **kwargs)
-    except excClass: pass
-    else: raise Exception('expected %s; got %s' % (excClass.__name__, r))
-
 class TestRpcOperations(AvroTester):
     def test_insert_super(self):
         "setting and getting a super column"
@@ -113,80 +108,7 @@ class TestRpcOperations(AvroTester):
         part = "org.apache.cassandra.dht.CollatingOrderPreservingPartitioner"
         result = self.client.request('describe_partitioner', {})
         assert result == part, "got %s, expected %s" % (result, part)
-              
-    def test_system_column_family_operations(self):
-        "adding, renaming, and removing column families"
-        self.__set_keyspace('Keyspace1')
-        
-        # create
-        columnDef = dict()
-        columnDef['name'] = b'ValidationColumn'
-        columnDef['validation_class'] = 'BytesType'
-        
-        cfDef = dict()
-        cfDef['keyspace'] = 'Keyspace1'
-        cfDef['name'] = 'NewColumnFamily'
-        cfDef['column_metadata'] = [columnDef]
-        s = self.client.request('system_add_column_family', {'cf_def' : cfDef})
-        assert isinstance(s, unicode), \
-            'returned type is %s, (not \'unicode\')' % type(s)
-        
-        ks1 = self.client.request(
-            'describe_keyspace', {'keyspace' : 'Keyspace1'})
-        assert 'NewColumnFamily' in [x['name'] for x in ks1['cf_defs']]
-
-        # rename
-        self.client.request('system_rename_column_family',
-            {'old_name' : 'NewColumnFamily', 'new_name': 'RenameColumnFamily'})
-        ks1 = self.client.request(
-            'describe_keyspace', {'keyspace' : 'Keyspace1'})
-        assert 'RenameColumnFamily' in [x['name'] for x in ks1['cf_defs']]
-
-        # drop
-        self.client.request('system_drop_column_family',
-            {'column_family' : 'RenameColumnFamily'})
-        ks1 = self.client.request(
-                'describe_keyspace', {'keyspace' : 'Keyspace1'})
-        assert 'RenameColumnFamily' not in [x['name'] for x in ks1['cf_defs']]
-        assert 'NewColumnFamily' not in [x['name'] for x in ks1['cf_defs']]
-        assert 'Standard1' in [x['name'] for x in ks1['cf_defs']]
-
-    def test_system_keyspace_operations(self):
-        "adding, renaming, and removing keyspaces"
-        
-        # create
-        keyspace = dict()
-        keyspace['name'] = 'CreateKeyspace'
-        keyspace['strategy_class'] = 'org.apache.cassandra.locator.SimpleStrategy'
-        keyspace['replication_factor'] = 1
-        keyspace['strategy_options'] = {}
-        cfdef = dict();
-        cfdef['keyspace'] = 'CreateKeyspace'
-        cfdef['name'] = 'CreateKsCf'
-        keyspace['cf_defs'] = [cfdef]
-        
-        s = self.client.request('system_add_keyspace', {'ks_def' : keyspace})
-        assert isinstance(s, unicode), 'returned type is %s, (not \'unicode\')' % type(s)
-        
-        # rename
-        self.client.request('set_keyspace', {'keyspace' : 'CreateKeyspace'})
-        s = self.client.request(
-                'system_rename_keyspace', {'old_name' : 'CreateKeyspace', 'new_name' : 'RenameKeyspace'})
-        assert isinstance(s, unicode), 'returned type is %s, (not \'unicode\')' % type(s)
-        renameks = self.client.request('describe_keyspace',
-                {'keyspace': 'RenameKeyspace'})
-        assert renameks['name'] == 'RenameKeyspace'
-        assert renameks['cf_defs'][0]['name'] == 'CreateKsCf'
-        
-        # drop
-        s = self.client.request('system_drop_keyspace', {'keyspace' : 'RenameKeyspace'})
-        assert isinstance(s, unicode), 'returned type is %s, (not \'unicode\')' % type(s)
-        assert_raises(AvroRemoteException,
-                      self.client.request,
-                      'describe_keyspace',
-                      {'keyspace' : 'RenameKeyspace'})
-        
-        
+       
     def __get(self, key, cf, super_name, col_name, consistency_level='ONE'):
         """
         Given arguments for the key, column family, super column name,

Modified: cassandra/trunk/test/system/test_avro_standard.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_avro_standard.py?rev=991609&r1=991608&r2=991609&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_avro_standard.py (original)
+++ cassandra/trunk/test/system/test_avro_standard.py Wed Sep  1 17:22:07 2010
@@ -16,6 +16,7 @@
 # limitations under the License.
 
 from . import AvroTester
+import avro_utils
 from avro.ipc import AvroRemoteException
 
 class TestStandardOperations(AvroTester):
@@ -72,7 +73,7 @@ class TestStandardOperations(AvroTester)
 
         self.client.request('remove', remove_params)
 
-        assert_raises(AvroRemoteException,
+        avro_utils.assert_raises(AvroRemoteException,
                 self.client.request, 'get', read_params)
 
     def test_batch_mutate(self):
@@ -119,7 +120,7 @@ class TestStandardOperations(AvroTester)
         self.client.request('batch_mutate', params)
 
         # Ensure successful column removal
-        assert_raises(AvroRemoteException,
+        avro_utils.assert_raises(AvroRemoteException,
                 self.__get, 'key1', 'Standard1', None, remove_column['name'])
 
         # Ensure successful column addition

Modified: cassandra/trunk/test/system/test_avro_system.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_avro_system.py?rev=991609&r1=991608&r2=991609&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_avro_system.py (original)
+++ cassandra/trunk/test/system/test_avro_system.py Wed Sep  1 17:22:07 2010
@@ -15,6 +15,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import avro_utils
 from . import AvroTester
 from avro.ipc import AvroRemoteException
 
@@ -22,6 +23,74 @@ class TestSystemOperations(AvroTester):
     """
     Cassandra system operations.
     """
-    pass
-    def test_test(self):
-        pass
+    def test_system_keyspace_operations(self):
+        "adding, renaming, and removing keyspaces"
+        
+        # create
+        keyspace = dict()
+        keyspace['name'] = 'CreateKeyspace'
+        keyspace['strategy_class'] = 'org.apache.cassandra.locator.SimpleStrategy'
+        keyspace['replication_factor'] = 1
+        keyspace['strategy_options'] = {}
+        cfdef = dict();
+        cfdef['keyspace'] = 'CreateKeyspace'
+        cfdef['name'] = 'CreateKsCf'
+        keyspace['cf_defs'] = [cfdef]
+        
+        s = self.client.request('system_add_keyspace', {'ks_def' : keyspace})
+        assert isinstance(s, unicode), 'returned type is %s, (not \'unicode\')' % type(s)
+        
+        # rename
+        self.client.request('set_keyspace', {'keyspace' : 'CreateKeyspace'})
+        s = self.client.request(
+                'system_rename_keyspace', {'old_name' : 'CreateKeyspace', 'new_name' : 'RenameKeyspace'})
+        assert isinstance(s, unicode), 'returned type is %s, (not \'unicode\')' % type(s)
+        renameks = self.client.request('describe_keyspace',
+                {'keyspace': 'RenameKeyspace'})
+        assert renameks['name'] == 'RenameKeyspace'
+        assert renameks['cf_defs'][0]['name'] == 'CreateKsCf'
+        
+        # drop
+        s = self.client.request('system_drop_keyspace', {'keyspace' : 'RenameKeyspace'})
+        assert isinstance(s, unicode), 'returned type is %s, (not \'unicode\')' % type(s)
+        avro_utils.assert_raises(AvroRemoteException,
+                      self.client.request,
+                      'describe_keyspace',
+                      {'keyspace' : 'RenameKeyspace'})
+    def test_system_column_family_operations(self):
+        "adding, renaming, and removing column families"
+        self.client.request('set_keyspace', {'keyspace': 'Keyspace1'})
+        
+        # create
+        columnDef = dict()
+        columnDef['name'] = b'ValidationColumn'
+        columnDef['validation_class'] = 'BytesType'
+        
+        cfDef = dict()
+        cfDef['keyspace'] = 'Keyspace1'
+        cfDef['name'] = 'NewColumnFamily'
+        cfDef['column_metadata'] = [columnDef]
+        s = self.client.request('system_add_column_family', {'cf_def' : cfDef})
+        assert isinstance(s, unicode), \
+            'returned type is %s, (not \'unicode\')' % type(s)
+        
+        ks1 = self.client.request(
+            'describe_keyspace', {'keyspace' : 'Keyspace1'})
+        assert 'NewColumnFamily' in [x['name'] for x in ks1['cf_defs']]
+
+        # rename
+        self.client.request('system_rename_column_family',
+            {'old_name' : 'NewColumnFamily', 'new_name': 'RenameColumnFamily'})
+        ks1 = self.client.request(
+            'describe_keyspace', {'keyspace' : 'Keyspace1'})
+        assert 'RenameColumnFamily' in [x['name'] for x in ks1['cf_defs']]
+
+        # drop
+        self.client.request('system_drop_column_family',
+            {'column_family' : 'RenameColumnFamily'})
+        ks1 = self.client.request(
+                'describe_keyspace', {'keyspace' : 'Keyspace1'})
+        assert 'RenameColumnFamily' not in [x['name'] for x in ks1['cf_defs']]
+        assert 'NewColumnFamily' not in [x['name'] for x in ks1['cf_defs']]
+        assert 'Standard1' in [x['name'] for x in ks1['cf_defs']]
+



Mime
View raw message