def test_missing_super(self):
     "verifies that inserting doesn't yield false positives."
     self._set_keyspace('Keyspace1')
     avro_utils.assert_raises(AvroRemoteException,
             self.client.request,
             'get',
             _make_read_params('key1', 'Super1', 'sc1', avro_utils.i64(1), 'ONE'))
     self._insert_super()
     avro_utils.assert_raises(AvroRemoteException,
             self.client.request,
             'get',
             _make_read_params('key1', 'Super1', 'sc1', avro_utils.i64(1), 'ONE'))
예제 #2
0
 def test_missing_super(self):
     "verifies that inserting doesn't yield false positives."
     self._set_keyspace('Keyspace1')
     avro_utils.assert_raises(
         AvroRemoteException, self.client.request, 'get',
         _make_read_params('key1', 'Super1', 'sc1', avro_utils.i64(1),
                           'ONE'))
     self._insert_super()
     avro_utils.assert_raises(
         AvroRemoteException, self.client.request, 'get',
         _make_read_params('key1', 'Super1', 'sc1', avro_utils.i64(1),
                           'ONE'))
예제 #3
0
 def _insert_super(self, key='key1'):
     self.client.request(
         'insert',
         _make_write_params(key, 'Super1', 'sc1', avro_utils.i64(4),
                            'value4', 0, 'ONE'))
     self.client.request(
         'insert',
         _make_write_params(key, 'Super1', 'sc2', avro_utils.i64(5),
                            'value5', 0, 'ONE'))
     self.client.request(
         'insert',
         _make_write_params(key, 'Super1', 'sc2', avro_utils.i64(6),
                            'value6', 0, 'ONE'))
예제 #4
0
 def _verify_super(self, supercf='Super1', key='key1'):
     col = self.client.request(
         'get',
         _make_read_params(key, supercf, 'sc1', avro_utils.i64(4),
                           'ONE'))['column']
     avro_utils.assert_columns_match(col, {
         'name': avro_utils.i64(4),
         'value': 'value4',
         'timestamp': 0
     })
     slice = [
         result['super_column']
         for result in self._big_slice(key, {'column_family': supercf})
     ]
     assert slice == _SUPER_COLUMNS, _SUPER_COLUMNS
def _i64(i):
    return avro_utils.i64(i)
 def _verify_super(self, supercf='Super1', key='key1'):
     col = self.client.request('get', _make_read_params(key, supercf, 'sc1', avro_utils.i64(4), 'ONE'))['column']
     avro_utils.assert_columns_match(col, {'name': avro_utils.i64(4), 'value': 'value4', 'timestamp': 0})
     slice = [result['super_column'] for result in self._big_slice(key, {'column_family': supercf})]
     assert slice == _SUPER_COLUMNS, _SUPER_COLUMNS
 def _insert_super(self, key='key1'):
     self.client.request('insert', _make_write_params(key, 'Super1', 'sc1', avro_utils.i64(4), 'value4', 0, 'ONE'))
     self.client.request('insert', _make_write_params(key, 'Super1', 'sc2', avro_utils.i64(5), 'value5', 0, 'ONE'))
     self.client.request('insert', _make_write_params(key, 'Super1', 'sc2', avro_utils.i64(6), 'value6', 0, 'ONE'))
    last_exception = None
    while not success and time.time() < start + secs:
        try:
            fn(*args, **kwargs)
            success = True
        except KeyboardInterrupt:
            raise
        except Exception, e:
            last_exception = e
            pass
    if not success and last_exception:
        raise last_exception

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))])]
    
class TestSuperOperations(AvroTester):

    def _set_keyspace(self, keyspace):
        self.client.request('set_keyspace', {'keyspace': keyspace})
        
    """
    Operations on Super column families
    """
    def test_super_insert(self):
        "simple super column insert"
        self._set_keyspace('Keyspace1')
        self._insert_super()
예제 #9
0
def _i64(i):
    return avro_utils.i64(i)
예제 #10
0
        cp['column_family'] = args[0]
    for k, v in kwargs.items():
        cp[k] = v
    return cp


def Column(name, value, timestamp, ttl=None):
    return {'name': name, 'value': value, 'timestamp': timestamp, 'ttl': ttl}


def _i64(i):
    return avro_utils.i64(i)


_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):
    def _set_keyspace(self, keyspace):
        self.client.request('set_keyspace', {'keyspace': keyspace})

    """
    Operations on Super column families
    """
예제 #11
0
   
def ColumnPath(*args, **kwargs):
    cp = {}
    if args and len(args) > 0:
        cp['column_family'] = args[0]
    for k,v in kwargs.items():
        cp[k] = v
    return cp

def Column(name, value, timestamp, ttl=None):
    return {'name':name, 'value':value, 'timestamp': timestamp, 'ttl': ttl}

def _i64(i):
    return avro_utils.i64(i)

_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):

    def _set_keyspace(self, keyspace):
        self.client.request('set_keyspace', {'keyspace': keyspace})
        
    """
    Operations on Super column families
    """
    def test_super_insert(self):
        "simple super column insert"
        self._set_keyspace('Keyspace1')
        self._insert_super()