def test_builtin_with_instance_serializer_and_no_class_serializer(self): # Invoke put() for data record with builtin serializer and an # instance serializer set hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist, 'serialization': ((lambda v: json.dumps(v)), (lambda v: json.loads(v))) } if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 12) try: client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1, 2, 3)} res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON) assert res == 0 _, _, bins = client.get(key) assert bins == {'normal': 1234, 'tuple': (1, 2, 3)} client.remove(key) client.close()
def test_with_class_serializer_and_instance_serializer(self): """ Invoke put() for mixed data record with class and instance serializer. """ aerospike.set_serializer((lambda v: json.dumps(v))) aerospike.set_deserializer((lambda v: json.loads(v))) hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist, 'serialization': ((lambda v: marshal.dumps(v)), (lambda v: marshal.loads(v)))} if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 16) try: TestPythonSerializer.client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1,2,3)} res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER) assert res == 0 _, _, bins = client.get(key) # tuples JSON-encode to a list, and we use this fact to check which # serializer ran: assert bins == {'normal': 1234, 'tuple': (1,2,3)} client.remove(key)
def setup_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestApply.client = aerospike.client(config).connect() else: TestApply.client = aerospike.client(config).connect(user, password) TestApply.skip_old_server = True versioninfo = TestApply.client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6: TestApply.skip_old_server = False policy = {} TestApply.client.index_integer_create('test', 'demo', 'age', 'age_index', policy) policy = {} TestApply.client.index_integer_create('test', 'demo', 'age1', 'age_index1', policy) policy = {} filename = "sample.lua" udf_type = 0 status = TestApply.client.udf_put(filename, udf_type, policy) filename = "test_record_udf.lua" status = TestApply.client.udf_put(filename, udf_type, policy)
def setup_class(cls): print "setup class invoked..." hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': hostlist } if user == None and password == None: TestLList.client = aerospike.client(config).connect() else: TestLList.client = aerospike.client(config).connect(user, password) TestLList.key1 = ('test', 'demo', 'integer_llist_ky') TestLList.llist_integer = TestLList.client.llist(TestLList.key1, 'integer_bin') TestLList.key2 = ('test', 'demo', 'string_llist_ky') TestLList.llist_string = TestLList.client.llist(TestLList.key2, 'string_bin') TestLList.key3 = ('test', 'demo', 'float_llist_ky') TestLList.llist_float = TestLList.client.llist(TestLList.key3, 'float_bin')
def setup_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) client.index_integer_create('test', 'demo', 'test_age', 'age_index') client.index_string_create('test', 'demo', 'addr', 'addr_index') client.index_integer_create('test', 'demo', 'age1', 'age_index1') client.index_list_create('test', 'demo', 'numeric_list', aerospike.INDEX_NUMERIC, 'numeric_list_index') client.index_list_create('test', 'demo', 'string_list', aerospike.INDEX_STRING, 'string_list_index') client.index_map_keys_create('test', 'demo', 'numeric_map', aerospike.INDEX_NUMERIC, 'numeric_map_index') client.index_map_keys_create('test', 'demo', 'string_map', aerospike.INDEX_STRING, 'string_map_index') client.index_map_values_create('test', 'demo', 'numeric_map', aerospike.INDEX_NUMERIC, 'numeric_map_values_index') client.index_map_values_create('test', 'demo', 'string_map', aerospike.INDEX_STRING, 'string_map_values_index') client.index_integer_create('test', None, 'test_age_none', 'age_index_none')
def test_with_unset_serializer_python_serializer(self): """ Invoke put() for mixed data record with python serializer and calling unset_serializers """ aerospike.set_serializer((lambda v: json.dumps(v))) aerospike.set_deserializer((lambda v: json.loads(v))) hostlist, user, password = TestBaseClass.get_hosts() method_config = {'hosts': hostlist} if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 16) try: client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1, 2, 3)} aerospike.unset_serializers() res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON) assert res == 0 _, _, bins = client.get(key) # tuples JSON-encode to a list, and we use this fact to check which # serializer ran: assert bins == {'normal': 1234, 'tuple': (1, 2, 3)} client.remove(key)
def test_with_class_serializer_and_instance_serializer(self): """ Invoke put() for mixed data record with class and instance serializer. """ aerospike.set_serializer((lambda v: json.dumps(v))) aerospike.set_deserializer((lambda v: json.loads(v))) hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist, 'serialization': ((lambda v: marshal.dumps(v)), (lambda v: marshal.loads(v))) } if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 16) try: TestPythonSerializer.client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1, 2, 3)} res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER) assert res == 0 _, _, bins = client.get(key) # tuples JSON-encode to a list, and we use this fact to check which # serializer ran: assert bins == {'normal': 1234, 'tuple': (1, 2, 3)} client.remove(key)
def test_builtin_with_instance_serializer_and_no_class_serializer(self): # Invoke put() for data record with builtin serializer and an # instance serializer set hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist, 'serialization': ((lambda v: json.dumps(v)), (lambda v: json.loads(v)))} if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 12) try: client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1,2,3)} res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON) assert res == 0 _, _, bins = client.get(key) assert bins == {'normal': 1234, 'tuple': (1,2,3)} client.remove(key) client.close()
def setup_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestApply.client = aerospike.client(config).connect() else: TestApply.client = aerospike.client(config).connect(user, password) TestApply.skip_old_server = True versioninfo = TestApply.client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6: TestApply.skip_old_server = False policy = {} TestApply.client.index_integer_create('test', 'demo', 'age', 'age_index', policy) policy = {} TestApply.client.index_integer_create('test', 'demo', 'age1', 'age_index1', policy) policy = {} filename = "sample.lua" udf_type = 0 status = TestApply.client.udf_put(filename, udf_type, policy) filename = "test_record_udf.lua" status = TestApply.client.udf_put(filename, udf_type, policy)
def setup_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': hostlist, 'lua':{'user_path': '/tmp/', 'system_path':'../aerospike-client-c/lua/'}} if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) TestAggregate.skip_old_server = True versioninfo = client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6: TestAggregate.skip_old_server = False client.index_integer_create('test', 'demo', 'test_age', 'test_demo_test_age_idx') client.index_integer_create('test', 'demo', 'age1', 'test_demo_age1_idx') time.sleep(2) filename = "stream_example.lua" udf_type = aerospike.UDF_TYPE_LUA status = client.udf_put(filename, udf_type) shutil.copyfile(filename, config['lua']['user_path'] + 'stream_example.lua') client.close()
def setup_class(cls): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestOperate.client = aerospike.client(config).connect() else: TestOperate.client = aerospike.client(config).connect(user, password) config_no_typechecks = {'hosts': hostlist, 'strict_types': False} if user == None and password == None: TestOperate.client_no_typechecks = aerospike.client(config_no_typechecks).connect() else: TestOperate.client_no_typechecks = aerospike.client(config_no_typechecks).connect(user, password) TestOperate.skip_old_server = True versioninfo = TestOperate.client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6: TestOperate.skip_old_server = False
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': hostlist, 'lua':{'user_path': '/tmp/', 'system_path':'../aerospike-client-c/lua/'}} if TestBaseClass.user == None and TestBaseClass.password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect( TestBaseClass.user, TestBaseClass.password) for i in xrange(5): key = ('test', 'demo', i) rec = { 'name': 'name%s' % (str(i)), 'addr': 'name%s' % (str(i)), 'test_age': i, 'no': i } self.client.put(key, rec)
def setup_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': hostlist, 'lua': { 'user_path': '/tmp/', 'system_path': '../aerospike-client-c/lua/' } } if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) TestAggregate.skip_old_server = True versioninfo = client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6: TestAggregate.skip_old_server = False client.index_integer_create('test', 'demo', 'test_age', 'test_demo_test_age_idx') client.index_integer_create('test', 'demo', 'age1', 'test_demo_age1_idx') time.sleep(2) filename = "stream_example.lua" udf_type = aerospike.UDF_TYPE_LUA status = client.udf_put(filename, udf_type) shutil.copyfile(filename, config['lua']['user_path'] + 'stream_example.lua') client.close()
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': hostlist, 'lua': { 'user_path': '/tmp/', 'system_path': '../aerospike-client-c/lua/' } } if TestBaseClass.user == None and TestBaseClass.password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect( TestBaseClass.user, TestBaseClass.password) for i in xrange(5): key = ('test', 'demo', i) rec = { 'name': 'name%s' % (str(i)), 'addr': 'name%s' % (str(i)), 'test_age': i, 'no': i } self.client.put(key, rec)
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) for i in xrange(19): key = ('test', u'demo', i) rec = {'name': 'name%s' % (str(i)), 'age': i} self.client.put(key, rec) key = ('test', u'demo', 122) list = [{"op": aerospike.OPERATOR_APPEND, "bin": bytearray("asd;adk\0kj", "utf-8"), "val": u"john"}]; self.client.operate(key, list) key = ('test', u'demo', 'ldt_key') self.llist_bin = self.client.llist(key, 'llist_key') self.llist_bin.add(10)
def setup_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) client.index_integer_create('test', 'demo', 'test_age', 'age_index') client.index_string_create('test', 'demo', 'addr', 'addr_index') client.index_integer_create('test', 'demo', 'age1', 'age_index1') client.index_list_create('test', 'demo', 'numeric_list', aerospike.INDEX_NUMERIC, 'numeric_list_index') client.index_list_create('test', 'demo', 'string_list', aerospike.INDEX_STRING, 'string_list_index') client.index_map_keys_create('test', 'demo', 'numeric_map', aerospike.INDEX_NUMERIC, 'numeric_map_index') client.index_map_keys_create('test', 'demo', 'string_map', aerospike.INDEX_STRING, 'string_map_index') client.index_map_values_create('test', 'demo', 'numeric_map', aerospike.INDEX_NUMERIC, 'numeric_map_values_index') client.index_map_values_create('test', 'demo', 'string_map', aerospike.INDEX_STRING, 'string_map_values_index') client.index_integer_create('test', None, 'test_age_none', 'age_index_none')
def test_instance_serializer_and_no_class_serializer(self): # Invoke put() for record with no class serializer. There is an # instance serializer hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist, 'serialization': ((lambda v: json.dumps(v)), (lambda v: json.loads(v))) } if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 11) try: client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1, 2, 3)} res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER) assert res == 0 _, _, bins = client.get(key) # tuples JSON-encode to a list, and we use this fact to check which # serializer ran: assert bins == {'normal': 1234, 'tuple': [1, 2, 3]} client.remove(key) client.close()
def test_instance_serializer_and_no_class_serializer(self): # Invoke put() for record with no class serializer. There is an # instance serializer hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist, 'serialization': ((lambda v: json.dumps(v)), (lambda v: json.loads(v)))} if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 11) try: client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1,2,3)} res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER) assert res == 0 _, _, bins = client.get(key) # tuples JSON-encode to a list, and we use this fact to check which # serializer ran: assert bins == {'normal': 1234, 'tuple': [1,2,3]} client.remove(key) client.close()
def test_with_class_serializer_and_instance_serializer_with_unset_serializer( self): """ Invoke put() for mixed data record with python serializer. """ aerospike.set_serializer((lambda v: json.dumps(v))) aerospike.set_deserializer((lambda v: json.loads(v))) hostlist, user, password = TestBaseClass.get_hosts() method_config = {'hosts': hostlist} if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 16) try: TestPythonSerializer.client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1, 2, 3)} aerospike.unset_serializers() try: res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER) except ClientError as exception: assert exception.code == -1 assert exception.msg == "No serializer callback registered"
def test_with_unset_serializer_python_serializer(self): """ Invoke put() for mixed data record with python serializer and calling unset_serializers """ aerospike.set_serializer((lambda v: json.dumps(v))) aerospike.set_deserializer((lambda v: json.loads(v))) hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist } if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 16) try: client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1,2,3)} aerospike.unset_serializers() res = client.put(key, rec, serializer=aerospike.SERIALIZER_PYTHON) assert res == 0 _, _, bins = client.get(key) # tuples JSON-encode to a list, and we use this fact to check which # serializer ran: assert bins == {'normal': 1234, 'tuple': (1,2,3)} client.remove(key)
def setup_class(cls): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestOperate.client = aerospike.client(config).connect() else: TestOperate.client = aerospike.client(config).connect( user, password) config_no_typechecks = {'hosts': hostlist, 'strict_types': False} if user == None and password == None: TestOperate.client_no_typechecks = aerospike.client( config_no_typechecks).connect() else: TestOperate.client_no_typechecks = aerospike.client( config_no_typechecks).connect(user, password) TestOperate.skip_old_server = True versioninfo = TestOperate.client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6: TestOperate.skip_old_server = False
def test_with_class_serializer_and_instance_serializer_with_unset_serializer(self): """ Invoke put() for mixed data record with python serializer. """ aerospike.set_serializer((lambda v: json.dumps(v))) aerospike.set_deserializer((lambda v: json.loads(v))) hostlist, user, password = TestBaseClass.get_hosts() method_config = { 'hosts': hostlist } if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) key = ('test', 'demo', 16) try: TestPythonSerializer.client.remove(key) except: pass rec = {'normal': 1234, 'tuple': (1,2,3)} aerospike.unset_serializers() try: res = client.put(key, rec, serializer=aerospike.SERIALIZER_USER) except ClientError as exception: assert exception.code == -1 assert exception.msg == "No serializer callback registered"
def test_put_with_mixeddata_client_serializer_deserializer_with_spec_in_put(self): # Invoke put() for mixed data with class and instance serialziers # with a specification in put. Client one is called hostlist, user, password = TestBaseClass.get_hosts() method_config = {'hosts': hostlist, 'serialization': (client_serialize_function, client_deserialize_function)} if user == None and password == None: client = aerospike.client(method_config).connect() else: client = aerospike.client(method_config).connect(user, password) response = aerospike.set_serializer(serialize_function) response = aerospike.set_deserializer(deserialize_function) key = ('test', 'demo', 1) rec = { 'map': {"key": "asd';q;'1';", "pi": 3}, 'normal': 1234, 'special': '!@#@#$QSDAsd;as', 'list': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8")], 'bytes': bytearray("asd;as[d'as;d", "utf-8"), 'nestedlist': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8"), [1, bytearray("asd;as[d'as;d", "utf-8")]], 'nestedmap': { "key": "asd';q;'1';", "pi": 314, "nest": {"pi1": 312, "t": 1} }, } res = client.put(key, rec, {}, {}, aerospike.SERIALIZER_USER) assert res == 0 _, _, bins = client.get(key) assert bins == { 'map': {"key": "asd';q;'1';", "pi": 3}, 'normal': 1234, 'special': '!@#@#$QSDAsd;as', 'list': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8")], 'bytes': bytearray("asd;as[d'as;d", "utf-8"), 'nestedlist': ["nanslkdl", 1, bytearray("asd;as[d'as;d", "utf-8"), [1, bytearray("asd;as[d'as;d", "utf-8")]], 'nestedmap': { "key": "asd';q;'1';", "pi": 314, "nest": {"pi1": 312, "t": 1} }, } client.close() self.delete_keys.append(key)
def setup_class(cls): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestExists.client = aerospike.client(config).connect() else: TestExists.client = aerospike.client(config).connect(user, password)
def setup_class(cls): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestGet.client = aerospike.client(config).connect() else: TestGet.client = aerospike.client(config).connect(user, password)
def setup_class(cls): """ Setup method. """ TestGetMany.hostlist, TestGetMany.user, TestGetMany.password = TestBaseClass.get_hosts() config = {"hosts": TestGetMany.hostlist} if TestGetMany.user == None and TestGetMany.password == None: TestGetMany.client = aerospike.client(config).connect() else: TestGetMany.client = aerospike.client(config).connect(TestGetMany.user, TestGetMany.password)
def setup_class(cls): """ Setup class """ hostlist, user, password = TestBaseClass.get_hosts() config = {"hosts": hostlist} if user == None and password == None: TestPut.client = aerospike.client(config).connect() else: TestPut.client = aerospike.client(config).connect(user, password)
def setup_class(cls): """ Setup method. """ TestGetMany.hostlist, TestGetMany.user, TestGetMany.password = TestBaseClass.get_hosts() config = {'hosts': TestGetMany.hostlist} if TestGetMany.user == None and TestGetMany.password == None: TestGetMany.client = aerospike.client(config).connect() else: TestGetMany.client = aerospike.client(config).connect(TestGetMany.user, TestGetMany.password)
def setup_class(cls): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestGeospatial.client = aerospike.client(config).connect() else: TestGeospatial.client = aerospike.client(config).connect(user, password) TestGeospatial.client.index_geo2dsphere_create("test", "demo", "loc", "loc_index")
def setup_class(cls): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestGeospatial.client = aerospike.client(config).connect() else: TestGeospatial.client = aerospike.client(config).connect(user, password) TestGeospatial.client.index_geo2dsphere_create("test", "demo", "loc", "loc_index")
def setup_class(cls): """ Setup class. """ TestInfo.hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': TestInfo.hostlist} TestInfo.config = config if user == None and password == None: TestInfo.client = aerospike.client(config).connect() else: TestInfo.client = aerospike.client(config).connect(user, password)
def setup_class(cls): """ Setup class """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestUserSerializer.client = aerospike.client(config).connect() else: TestUserSerializer.client = aerospike.client(config).connect(user, password) response = aerospike.set_serializer(serialize_function) response = aerospike.set_deserializer(deserialize_function)
def test_isconnected_positive(self): """ Invoke is_connected() positive. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) assert self.client.is_connected() == True self.client.close()
def setup_class(cls): """ Setup class. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestGetRegistered.client = aerospike.client(config).connect() else: TestGetRegistered.client = aerospike.client(config).connect( user, password) policy = {'timeout': 5000} TestGetRegistered.client.udf_put(u"bin_lua.lua", 0, policy)
def setup_class(cls): """ Setup class """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestPythonSerializer.client = aerospike.client(config).connect() else: TestPythonSerializer.client = aerospike.client(config).connect(user, password) # Unset previously set class serializers if set aerospike.unset_serializers()
def setup_class(cls): print "setup class invoked..." hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestLSet.client = aerospike.client(config).connect() else: TestLSet.client = aerospike.client(config).connect(user, password) TestLSet.key = ('test', 'demo', 'lset_add_key') TestLSet.lset = TestLSet.client.lset(TestLSet.key, 'lset_add_bin')
def setup_class(cls): """ Setup class. """ TestInfo.hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': TestInfo.hostlist } TestInfo.config = config if user == None and password == None: TestInfo.client = aerospike.client(config).connect() else: TestInfo.client = aerospike.client(config).connect(user, password)
def setup_class(cls): """ Setup class """ hostlist, user, password = TestBaseClass.get_hosts() config = {"hosts": hostlist} if user == None and password == None: TestUdfList.client = aerospike.client(config).connect() else: TestUdfList.client = aerospike.client(config).connect(user, password) TestUdfList.client.udf_put("example.lua", 0, {})
def setup_class(cls): """ Setup class """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestUdfList.client = aerospike.client(config).connect() else: TestUdfList.client = aerospike.client(config).connect( user, password) TestUdfList.client.udf_put('example.lua', 0, {})
def setup_class(cls): """ Setup class """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestPythonSerializer.client = aerospike.client(config).connect() else: TestPythonSerializer.client = aerospike.client(config).connect( user, password) # Unset previously set class serializers if set aerospike.unset_serializers()
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) for i in xrange(20): key = ('test', u'demo', i) rec = {'name': 'name%s' % (str(i)), 'age': i} self.client.put(key, rec)
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) for i in xrange(20): key = ('test', u'demo', i) rec = {'name': 'name%s' % (str(i)), 'age': i} self.client.put(key, rec)
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {"hosts": hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) for i in xrange(5): key = ("test", "demo", i) rec = {"name": "name%s" % (str(i)), "age": i} self.client.put(key, rec) policy = {} self.client.udf_put(u"bin_lua.lua", 0, policy)
def test_set_log_handler_correct(self): """ Test log handler with correct parameters """ response = aerospike.set_log_level(aerospike.LOG_LEVEL_DEBUG) aerospike.set_log_handler(handler) hostlist, user, password = TestBaseClass.get_hosts() config = {"hosts": hostlist} if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) assert response == 0 client.close()
def teardown_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': hostlist } if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) policy = {} client.index_remove('test', 'age_index', policy); client.index_remove('test', 'age_index1', policy); policy = { } module = "stream_example.lua" status = client.udf_remove( module, policy ) client.close()
def setup_class(cls): """ Setup class """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestUserSerializer.client = aerospike.client(config).connect() else: TestUserSerializer.client = aerospike.client(config).connect(user, password) TestUserSerializer.skip_old_server = True versioninfo = TestUserSerializer.client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 6: TestUserSerializer.skip_old_server = False
def teardown_class(cls): return hostlist, user, password = TestBaseClass.get_hosts() config = { 'hosts': hostlist, 'lua':{'user_path': '/tmp/', 'system_path':'../aerospike-client-c/lua/'}} if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) client.index_remove('test', 'test_demo_test_age_idx') client.index_remove('test', 'test_demo_age1_idx') module = "stream_example.lua" status = client.udf_remove(module) os.remove(config['lua']['user_path'] + 'stream_example.lua') client.close()
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) for i in xrange(5): key = ('test', 'demo', i) rec = {'name': 'name%s' % (str(i)), 'age': i} self.client.put(key, rec) policy = {} self.client.udf_put("bin_lua.lua", 0, policy) self.job_id = self.client.scan_apply("test", "demo", "bin_lua", "mytransform", ['age', 2])
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) for i in xrange(5): key = ('test', 'demo', i) rec = {'name': 'name%s' % (str(i)), 'age': i} self.client.put(key, rec) policy = {} self.client.udf_put("bin_lua.lua", 0, policy) self.job_id = self.client.scan_apply("test", "demo", "bin_lua", "mytransform", ['age', 2])
def teardown_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: client = aerospike.client(config).connect() else: client = aerospike.client(config).connect(user, password) policy = {} client.index_remove('test', 'age_index', policy) client.index_remove('test', 'age_index1', policy) client.index_remove('test', 'addr_index', policy) client.index_remove('test', 'numeric_list_index', policy) client.index_remove('test', 'string_list_index', policy) client.index_remove('test', 'numeric_map_index', policy) client.index_remove('test', 'string_map_index', policy) client.index_remove('test', 'numeric_map_values_index', policy) client.index_remove('test', 'string_map_values_index', policy) client.index_remove('test', 'age_index_none', policy) client.close()
def setup_class(self): print "setup class invoked..." hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) TestLList.key1 = ('test', 'demo', 'integer_llist_ky') TestLList.llist_integer = TestLList.client.llist(TestLList.key1, 'integer_bin') TestLList.key2 = ('test', 'demo', 'string_llist_ky') TestLList.llist_string = TestLList.client.llist(TestLList.key2, 'string_bin') TestLList.key3 = ('test', 'demo', 'float_llist_ky') TestLList.llist_float = TestLList.client.llist(TestLList.key3, 'float_bin')
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) self.client.index_integer_create('test', 'demo', 'age', 'test_demo_age_idx') self.client.index_integer_create('test', None, 'age', 'test_null_age_idx') for i in xrange(1, 5): key = ('test', 'demo', i) rec = {'name': 'name%s' % (str(i)), 'age': i} self.client.put(key, rec) policy = {} self.client.udf_put(u"bin_lua.lua", 0, policy)
def setup_class(cls): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: TestGeospatial.client = aerospike.client(config).connect() else: TestGeospatial.client = aerospike.client(config).connect(user, password) TestGeospatial.client.index_geo2dsphere_create("test", "demo", "loc", "loc_index") TestGeospatial.client.index_geo2dsphere_create("test", "demo", "loc_polygon", "loc_polygon_index") TestGeospatial.client.index_geo2dsphere_create("test", "demo", "loc_circle", "loc_circle_index") TestGeospatial.skip_old_server = True versioninfo = TestGeospatial.client.info('version') for keys in versioninfo: for value in versioninfo[keys]: if value != None: versionlist = value[value.find("build") + 6:value.find("\n")].split(".") if int(versionlist[0]) >= 3 and int(versionlist[1]) >= 7: TestGeospatial.skip_old_server = False
def setup_method(self, method): """ Setup method. """ hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} if user == None and password == None: self.client = aerospike.client(config).connect() else: self.client = aerospike.client(config).connect(user, password) for i in xrange(20): key = ('test', u'demo', i) rec = {'name': 'name%s' % (str(i)), 'age': i} self.client.put(key, rec) key = ('test', u'demo', 122) list = [{ "op": aerospike.OPERATOR_APPEND, "bin": bytearray("asd;adk\0kj", "utf-8"), "val": u"john" }] self.client.operate(key, list)
def setup_class(cls): hostlist, user, password = TestBaseClass.get_hosts() config = {'hosts': hostlist} TestConnect.config = config
def setup_class(cls): KVTestCase.hostlist, KVTestCase.user, KVTestCase.password = TestBaseClass.get_hosts( )