-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.py
33 lines (27 loc) · 1.11 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os
import sys
import select
from classes.ConfigJSON import ConfigJSON
from classes.ConfigINI import ConfigINI
from classes.Storage import Storage
from classes.BlockchainEMC import BlockchainEMC
from classes.DatabaseMySQL import DatabaseMySQL
from classes.Iteration import Iteration
from classes.LoaderFactory import LoaderFactory
config = ConfigJSON()
conf = config.get_config(os.path.dirname(__file__)+os.path.sep+'config/config.json')
# config = ConfigINI()
# conf = config.get_config(os.path.dirname(__file__)+os.path.sep+'config/config.ini')
# pprint.pp(conf['blockchain'])
blk = BlockchainEMC(conf['blockchain']['host'], conf['blockchain']['port'], conf['blockchain']['user'], conf['blockchain']['password'])
db = DatabaseMySQL(conf['database']['host'], conf['database']['port'], conf['database']['user'], conf['database']['password'], conf['database']['database'])
Storage.blockchain = blk
Storage.database = db
Storage.connection = db.check()
print("Importing test data")
url = conf['test']['url']
lf = LoaderFactory()
loader = lf.get_loader(url)
itr = Iteration()
itr.init_db()
itr.parse('test-data', loader.load(url))