cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eev...@apache.org
Subject svn commit: r1001889 - in /cassandra/trunk/test/system: test_avro_standard.py test_avro_super.py test_avro_system.py
Date Mon, 27 Sep 2010 19:44:07 GMT
Author: eevans
Date: Mon Sep 27 19:44:07 2010
New Revision: 1001889

URL: http://svn.apache.org/viewvc?rev=1001889&view=rev
Log:
update avro sys tests for Clock removal

Modified:
    cassandra/trunk/test/system/test_avro_standard.py
    cassandra/trunk/test/system/test_avro_super.py
    cassandra/trunk/test/system/test_avro_system.py

Modified: cassandra/trunk/test/system/test_avro_standard.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_avro_standard.py?rev=1001889&r1=1001888&r2=1001889&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_avro_standard.py (original)
+++ cassandra/trunk/test/system/test_avro_standard.py Mon Sep 27 19:44:07 2010
@@ -26,7 +26,7 @@ def new_column(suffix, stamp=None, ttl=0
     column = dict()
     column['name'] = 'name-%s' % suffix
     column['value'] = 'value-%s' % suffix
-    column['clock'] = {'timestamp': ts}
+    column['timestamp'] = ts
     column['ttl'] = ttl
     return column
 
@@ -96,7 +96,7 @@ class TestStandardOperations(AvroTester)
         params['column'] = dict()
         params['column']['name'] = struct.pack('bbbbbbbbbb',36,-62,-94,-30,-126,-84,-16,-92,-83,-94)
         params['column']['value'] = struct.pack('bbbbbbbbbb',36,-62,-94,-30,-126,-84,-16,-92,-83,-94)
-        params['column']['clock'] = {'timestamp': timestamp()}
+        params['column']['timestamp'] = timestamp()
         params['column']['ttl'] = None
         params['consistency_level'] = 'ONE'
         self.client.request('insert', params)
@@ -135,7 +135,7 @@ class TestStandardOperations(AvroTester)
         avro_utils.assert_cosc(cosc)
 
         remove_params = read_params
-        remove_params['clock'] = {'timestamp': timestamp()}
+        remove_params['timestamp'] = timestamp()
 
         self.client.request('remove', remove_params)
 
@@ -173,7 +173,7 @@ class TestStandardOperations(AvroTester)
         extra_column = new_column(3); remove_column = new_column(0)
         mutations = [{'column_or_supercolumn': {'column': extra_column}}]
         deletion = dict()
-        deletion['clock'] = {'timestamp': timestamp()}
+        deletion['timestamp'] = timestamp()
         deletion['predicate'] = {'column_names': [remove_column['name']]}
         mutations.append({'deletion': deletion})
 
@@ -344,11 +344,11 @@ class TestStandardOperations(AvroTester)
     def test_index_slice(self):
         self.client.request('set_keyspace', {'keyspace': 'Keyspace1'})
         cp = dict(column_family='Indexed1')
-        self.client.request('insert', dict(key='key1', column_parent=cp, column=dict(name='birthdate',
value=i64(1), clock={'timestamp': 0}), consistency_level='ONE'))
-        self.client.request('insert', dict(key='key2', column_parent=cp, column=dict(name='birthdate',
value=i64(2), clock={'timestamp': 0}), consistency_level='ONE'))
-        self.client.request('insert', dict(key='key2', column_parent=cp, column=dict(name='b',
value=i64(2), clock={'timestamp': 0}), consistency_level='ONE'))
-        self.client.request('insert', dict(key='key3', column_parent=cp, column=dict(name='birthdate',
value=i64(3), clock={'timestamp': 0}), consistency_level='ONE'))
-        self.client.request('insert', dict(key='key3', column_parent=cp, column=dict(name='b',
value=i64(3), clock={'timestamp': 0}), consistency_level='ONE'))
+        self.client.request('insert', dict(key='key1', column_parent=cp, column=dict(name='birthdate',
value=i64(1), timestamp=0), consistency_level='ONE'))
+        self.client.request('insert', dict(key='key2', column_parent=cp, column=dict(name='birthdate',
value=i64(2), timestamp=0), consistency_level='ONE'))
+        self.client.request('insert', dict(key='key2', column_parent=cp, column=dict(name='b',
value=i64(2), timestamp=0), consistency_level='ONE'))
+        self.client.request('insert', dict(key='key3', column_parent=cp, column=dict(name='birthdate',
value=i64(3), timestamp=0), consistency_level='ONE'))
+        self.client.request('insert', dict(key='key3', column_parent=cp, column=dict(name='b',
value=i64(3), timestamp=0), consistency_level='ONE'))
 
         # simple query on one index expression
         sp = dict(slice_range=dict(start='', finish='', reversed=False, count=1000))

Modified: cassandra/trunk/test/system/test_avro_super.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_avro_super.py?rev=1001889&r1=1001888&r2=1001889&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_avro_super.py (original)
+++ cassandra/trunk/test/system/test_avro_super.py Mon Sep 27 19:44:07 2010
@@ -20,7 +20,7 @@ from avro.ipc import AvroRemoteException
 import avro_utils
 import time
     
-def _make_write_params(key, cf, sc, c, v, clock=0, cl='ONE'):
+def _make_write_params(key, cf, sc, c, v, ts=0, cl='ONE'):
     params = dict()
     params['key'] = key
     params['column_parent'] = dict()
@@ -29,7 +29,7 @@ def _make_write_params(key, cf, sc, c, v
     params['column'] = dict()
     params['column']['name'] = c
     params['column']['value'] = v
-    params['column']['clock'] = { 'timestamp' : clock }
+    params['column']['timestamp'] = ts
     params['consistency_level'] = cl
     return params
     
@@ -69,7 +69,7 @@ def ColumnParent(*args, **kwargs):
 def Deletion(*args, **kwargs):
     cp = {}
     if args and len(args) > 0:
-        cp['clock'] = args[0]
+        cp['timestamp'] = args[0]
     for k,v in kwargs.items():
         cp[k] = v
     return cp
@@ -82,11 +82,8 @@ def ColumnPath(*args, **kwargs):
         cp[k] = v
     return cp
 
-def Clock(timestamp=0):
-    return {'timestamp': timestamp}
-
-def Column(name, value, clock, ttl=None):
-    return {'name':name, 'value':value, 'clock': clock, 'ttl': ttl}
+def Column(name, value, timestamp, ttl=None):
+    return {'name':name, 'value':value, 'timestamp': timestamp, 'ttl': ttl}
 
 def _i64(i):
     return avro_utils.i64(i)
@@ -109,9 +106,9 @@ def waitfor(secs, fn, *args, **kwargs):
 
 ZERO_WAIT = 5
     
-_SUPER_COLUMNS = [_super_col('sc1', [Column(avro_utils.i64(4), 'value4', Clock(0))]), 
-                  _super_col('sc2', [Column(avro_utils.i64(5), 'value5', Clock(0)), 
-                                     Column(avro_utils.i64(6), 'value6', Clock(0))])]
+_SUPER_COLUMNS = [_super_col('sc1', [Column(avro_utils.i64(4), 'value4', 0)]), 
+                  _super_col('sc2', [Column(avro_utils.i64(5), 'value5', 0), 
+                                     Column(avro_utils.i64(6), 'value6', 0)])]
     
 class TestSuperOperations(AvroTester):
 
@@ -163,10 +160,10 @@ class TestSuperOperations(AvroTester):
         p = SlicePredicate(slice_range=SliceRange('', '', False, 1))
         column_parent = ColumnParent('Super1', 'sc2')
         slice = [result['column'] for result in self.client.request('get_slice', {'key':
'key1', 'column_parent': column_parent, 'predicate': p, 'consistency_level': 'ONE'})]
-        assert slice == [Column(_i64(5), 'value5', Clock(0))], slice
+        assert slice == [Column(_i64(5), 'value5', 0)], slice
         p = SlicePredicate(slice_range=SliceRange('', '', True, 1))
         slice = [result['column'] for result in self.client.request('get_slice', {'key':
'key1', 'column_parent': column_parent, 'predicate': p, 'consistency_level': 'ONE'})]
-        assert slice == [Column(_i64(6), 'value6', Clock(0))], slice
+        assert slice == [Column(_i64(6), 'value6', 0)], slice
      
     def test_time_uuid(self):
         "test operation on timeuuid subcolumns in super columns"
@@ -176,7 +173,7 @@ class TestSuperOperations(AvroTester):
         # 100 isn't enough to fail reliably if the comparator is borked
         for i in xrange(500):
             L.append(uuid.uuid1())
-            self.client.request('insert', {'key': 'key1', 'column_parent': ColumnParent('Super4',
'sc1'), 'column': Column(L[-1].bytes, 'value%s' % i, Clock(i)), 'consistency_level': 'ONE'})
+            self.client.request('insert', {'key': 'key1', 'column_parent': ColumnParent('Super4',
'sc1'), 'column': Column(L[-1].bytes, 'value%s' % i, i), 'consistency_level': 'ONE'})
         slice = self._big_slice('key1', ColumnParent('Super4', 'sc1'))
         assert len(slice) == 500, len(slice)
         for i in xrange(500):
@@ -187,26 +184,26 @@ class TestSuperOperations(AvroTester):
         p = SlicePredicate(slice_range=SliceRange('', '', True, 1))
         column_parent = ColumnParent('Super4', 'sc1')
         slice = [result['column'] for result in self.client.request('get_slice', {'key':
'key1', 'column_parent': column_parent, 'predicate': p, 'consistency_level': 'ONE'})]
-        assert slice == [Column(L[-1].bytes, 'value499', Clock(499))], slice
+        assert slice == [Column(L[-1].bytes, 'value499', 499)], slice
 
         p = SlicePredicate(slice_range=SliceRange('', L[2].bytes, False, 1000))
         column_parent = ColumnParent('Super4', 'sc1')
         slice = [result['column'] for result in self.client.request('get_slice', {'key':
'key1', 'column_parent': column_parent, 'predicate': p, 'consistency_level': 'ONE'})]
-        assert slice == [Column(L[0].bytes, 'value0', Clock(0)),
-                         Column(L[1].bytes, 'value1', Clock(1)),
-                         Column(L[2].bytes, 'value2', Clock(2))], slice
+        assert slice == [Column(L[0].bytes, 'value0', 0),
+                         Column(L[1].bytes, 'value1', 1),
+                         Column(L[2].bytes, 'value2', 2)], slice
 
         p = SlicePredicate(slice_range=SliceRange(L[2].bytes, '', True, 1000))
         column_parent = ColumnParent('Super4', 'sc1')
         slice = [result['column'] for result in self.client.request('get_slice', {'key':
'key1', 'column_parent': column_parent, 'predicate': p, 'consistency_level': 'ONE'})]
-        assert slice == [Column(L[2].bytes, 'value2', Clock(2)),
-                         Column(L[1].bytes, 'value1', Clock(1)),
-                         Column(L[0].bytes, 'value0', Clock(0))], slice
+        assert slice == [Column(L[2].bytes, 'value2', 2),
+                         Column(L[1].bytes, 'value1', 1),
+                         Column(L[0].bytes, 'value0', 0)], slice
 
         p = SlicePredicate(slice_range=SliceRange(L[2].bytes, '', False, 1))
         column_parent = ColumnParent('Super4', 'sc1')
         slice = [result['column'] for result in self.client.request('get_slice', {'key':
'key1', 'column_parent': column_parent, 'predicate': p, 'consistency_level': 'ONE'})]
-        assert slice == [Column(L[2].bytes, 'value2', Clock(2))], slice
+        assert slice == [Column(L[2].bytes, 'value2', 2)], slice
     
     def test_batch_mutate_remove_super_columns_with_standard_under(self):
         "batch mutate with deletions in super columns"
@@ -220,7 +217,7 @@ class TestSuperOperations(AvroTester):
             names = []
             for c in sc['columns']:
                 names.append(c['name'])
-            mutations.append(Mutation(deletion=Deletion(Clock(20), super_column=c['name'],
predicate=SlicePredicate(column_names=names))))
+            mutations.append(Mutation(deletion=Deletion(20, super_column=c['name'], predicate=SlicePredicate(column_names=names))))
 
         mutation_map = dict((column_family, mutations) for column_family in column_families)
 

Modified: cassandra/trunk/test/system/test_avro_system.py
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/system/test_avro_system.py?rev=1001889&r1=1001888&r2=1001889&view=diff
==============================================================================
--- cassandra/trunk/test/system/test_avro_system.py (original)
+++ cassandra/trunk/test/system/test_avro_system.py Mon Sep 27 19:44:07 2010
@@ -20,7 +20,6 @@ from . import AvroTester
 from avro.ipc import AvroRemoteException
 
 # cheat a little until these are moved into avro_utils.
-from test_avro_super import Clock as Clock
 from test_avro_super import ColumnParent as ColumnParent
 from test_avro_super import SlicePredicate as SlicePredicate
 from test_avro_super import SliceRange as SliceRange
@@ -160,7 +159,7 @@ class TestSystemOperations(AvroTester):
             self.client.request('set_keyspace', {'keyspace': keyspace})
             
             # insert
-            self.client.request('insert', {'key': 'key0', 'column_parent': ColumnParent(cf_name),
'column': Column('colA', 'colA-value', Clock(0)), 'consistency_level': 'ONE' })
+            self.client.request('insert', {'key': 'key0', 'column_parent': ColumnParent(cf_name),
'column': Column('colA', 'colA-value', 0), 'consistency_level': 'ONE' })
             col1 = self.client.request('get_slice', {'key': 'key0', 'column_parent': ColumnParent(cf_name),
'predicate': SlicePredicate(slice_range=SliceRange('', '', False, 100)), 'consistency_level':
'ONE'})[0]['column']
             assert col1['name'] == 'colA' and col1['value'] == 'colA-value', col1
                     



Mime
View raw message