Example #1
0
    test_name = "Update"
    configpath = os.path.abspath('./edm.yml') if os.path.exists(
        './edm.yml') else sys.exit(1)

    config = None
    with open(configpath, 'r') as stream:
        try:
            config = yaml.load(stream)
        except yaml.YAMLError as e:
            raise Exception from e

    ret = 0
    # print(config)
    try:
        edm = ElasticDataManager()
        edm.connect(config, config['default_index'])
        edm.connection.create(index='group',
                              doc_type='doc',
                              id='g100',
                              body={
                                  "gid": 234,
                                  "owner": "bemineni",
                                  "name": "Sammy",
                                  "grp_hash": "456678",
                                  "description": "Sammy group"
                              })
        edm.update({
            '_index': 'group',
            '_type': "doc",
            '_id': 'g100',
Example #2
0
    test_name = "Add"
    configpath = os.path.abspath('./edm.yml') if os.path.exists(
        './edm.yml') else sys.exit(1)

    config = None
    with open(configpath, 'r') as stream:
        try:
            config = yaml.load(stream)
        except yaml.YAMLError as e:
            raise Exception from e

    ret = 0
    # print(config)
    try:
        edm = ElasticDataManager()
        edm.connect(config, config['default_index'])
        item = {
            '_index': 'group',
            '_type': 'doc',
            '_id': '2',
            '_source': {
                "gid": 234,
                "owner": "bemineni",
                "name": "Sammy",
                "grp_hash": "456678",
                "description": "Sammy group"
            }
        }

        edm.add(item)
Example #3
0
    test_name = "Abort"
    configpath = os.path.abspath('./edm.yml') if os.path.exists('./edm.yml') else sys.exit(1)

    config = None
    with open(configpath, 'r') as stream:
        try:
            config = yaml.load(stream)
        except yaml.YAMLError as e:
            raise Exception from e

    ret = 0
    # print(config)
    try:
        tdmgr = TestDataManager()
        edm = ElasticDataManager()
        edm.connect(config, config['default_index'])
        data = [{'_type': 'group',
                 '_id': 'g1',
                 '_source': {"gid": 234,
                             "owner": "bemineni",
                             "name": "Sammy",
                             "grp_hash": "456678",
                             "description": "Sammy group"
                             }
                 },
                {'_type': 'group',
                 '_id': 'g2',
                 '_source': {"gid": 456,
                             "owner": "bemineni",
                             "name": "Srikanth",
Example #4
0
    test_name = "Update_by_query"
    configpath = os.path.abspath('./edm.yml') if os.path.exists(
        './edm.yml') else sys.exit(1)

    config = None
    with open(configpath, 'r') as stream:
        try:
            config = yaml.load(stream)
        except yaml.YAMLError as e:
            raise Exception from e

    ret = 0
    # print(config)
    try:
        edm = ElasticDataManager()
        edm.connect(config, config['default_index'])

        data = [{
            '_index': 'group',
            '_type': 'doc',
            '_id': 'g2',
            '_source': {
                "gid": 234,
                "owner": "bemineni",
                "name": "Sammy",
                "grp_hash": "456678",
                "description": "Sammy group"
            }
        }, {
            '_index': 'group',
Example #5
0
    test_name = "Add"
    configpath = os.path.abspath('./edm.yml') if os.path.exists(
        './edm.yml') else sys.exit(1)

    config = None
    with open(configpath, 'r') as stream:
        try:
            config = yaml.load(stream)
        except yaml.YAMLError as e:
            raise Exception from e

    ret = 0
    # print(config)
    try:
        edm = ElasticDataManager()
        edm.connect(config, config['default_index'])

        edm.add({
            '_type': 'group',
            '_id': '2',
            '_source': {
                "gid": 234,
                "owner": "bemineni",
                "name": "Sammy",
                "grp_hash": "456678",
                "description": "Sammy group"
            }
        })
        transaction.commit()