|
@ -28,7 +28,10 @@ tdata = { |
|
|
"database": { |
|
|
"database": { |
|
|
"scheme": { |
|
|
"scheme": { |
|
|
"table": { |
|
|
"table": { |
|
|
"_data": [ |
|
|
D.DATA_ATTR_COUNT: 4, |
|
|
|
|
|
D.DATA_ATTR_DATE: "15.05.2022", |
|
|
|
|
|
B.DATA_NODE_HEADER: ["id", "name", "year", "position", "hobby"], |
|
|
|
|
|
B.DATA_NODE_DATA: [ |
|
|
{"id": 1, "name": "Brecht", "year": 2014, "position": "top", "hobby": "meaning"}, |
|
|
{"id": 1, "name": "Brecht", "year": 2014, "position": "top", "hobby": "meaning"}, |
|
|
{"id": 2, "name": "Meier", "year": 2015, "position": "first", "hobby": "reading" }, |
|
|
{"id": 2, "name": "Meier", "year": 2015, "position": "first", "hobby": "reading" }, |
|
|
{"id": 3, "name": "Smith", "year": 2018, "position": "second", "hobby": "writing"}, |
|
|
{"id": 3, "name": "Smith", "year": 2018, "position": "second", "hobby": "writing"}, |
|
@ -45,7 +48,10 @@ tdata = { |
|
|
"database": { |
|
|
"database": { |
|
|
"scheme": { |
|
|
"scheme": { |
|
|
"table": { |
|
|
"table": { |
|
|
"_data": [ |
|
|
D.DATA_ATTR_COUNT: 4, |
|
|
|
|
|
D.DATA_ATTR_DATE: "15.05.2022", |
|
|
|
|
|
B.DATA_NODE_HEADER: ["id", "name", "year", "position", "hobby"], |
|
|
|
|
|
B.DATA_NODE_DATA: [ |
|
|
{"id": 1, "name": "Brecht", "year": 2014, "position": "top", "hobby": "meaning"}, |
|
|
{"id": 1, "name": "Brecht", "year": 2014, "position": "top", "hobby": "meaning"}, |
|
|
{"id": 2, "name": "Maier", "year": 2015, "position": "first", "hobby": "reading"}, |
|
|
{"id": 2, "name": "Maier", "year": 2015, "position": "first", "hobby": "reading"}, |
|
|
{"id": 4, "name": "Smith", "year": 2018, "position": "second", "hobby": "writing"}, |
|
|
{"id": 4, "name": "Smith", "year": 2018, "position": "second", "hobby": "writing"}, |
|
@ -115,8 +121,8 @@ class MyTestCase(unittest.TestCase): |
|
|
matching = self.getMatching() |
|
|
matching = self.getMatching() |
|
|
utils.match_tool.setMatchkeys(matching, ":database:scheme:table:_data") |
|
|
utils.match_tool.setMatchkeys(matching, ":database:scheme:table:_data") |
|
|
utils.match_tool.getSimilarity(matching, |
|
|
utils.match_tool.getSimilarity(matching, |
|
|
tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"]["_data"][0], |
|
|
tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA][0], |
|
|
tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"]["_data"][0], 1) |
|
|
tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA][0], 1) |
|
|
|
|
|
|
|
|
def test_bestfit(self): |
|
|
def test_bestfit(self): |
|
|
job = Job("unit") |
|
|
job = Job("unit") |
|
@ -127,8 +133,8 @@ class MyTestCase(unittest.TestCase): |
|
|
comp.conf = conf |
|
|
comp.conf = conf |
|
|
matching = utils.match_tool.Matching(comp) |
|
|
matching = utils.match_tool.Matching(comp) |
|
|
matching.matchtype = M.MATCH_SUCCESS |
|
|
matching.matchtype = M.MATCH_SUCCESS |
|
|
matching.sideA = tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"]["_data"] |
|
|
matching.sideA = tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA] |
|
|
matching.sideB = tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"]["_data"] |
|
|
matching.sideB = tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA] |
|
|
utils.match_tool.matchBestfit(matching, ":database:scheme:table:_data") |
|
|
utils.match_tool.matchBestfit(matching, ":database:scheme:table:_data") |
|
|
print(json.dumps(matching.linksA)) |
|
|
print(json.dumps(matching.linksA)) |
|
|
print(json.dumps(matching.linksB)) |
|
|
print(json.dumps(matching.linksB)) |
|
@ -147,16 +153,16 @@ class MyTestCase(unittest.TestCase): |
|
|
comp.conf = conf |
|
|
comp.conf = conf |
|
|
matching = self.getMatching() |
|
|
matching = self.getMatching() |
|
|
matching.matchtype = M.MATCH_SUCCESS |
|
|
matching.matchtype = M.MATCH_SUCCESS |
|
|
matching.sideA = tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"]["_data"] |
|
|
matching.sideA = tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA] |
|
|
matching.sideB = tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"]["_data"] |
|
|
matching.sideB = tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA] |
|
|
ddl = conf[B.DATA_NODE_DDL]["database"]["scheme"]["table"] |
|
|
ddl = conf[B.DATA_NODE_DDL]["database"]["scheme"]["table"] |
|
|
header = [] |
|
|
header = [] |
|
|
for f in ddl["_header"]: |
|
|
for f in ddl["_header"]: |
|
|
header.append({D.DDL_FNAME: f, D.DDL_TYPE: ddl[f][D.DDL_TYPE], D.DDL_ACCEPTANCE: ddl[f][D.DDL_ACCEPTANCE]}) |
|
|
header.append({D.DDL_FNAME: f, D.DDL_TYPE: ddl[f][D.DDL_TYPE], D.DDL_ACCEPTANCE: ddl[f][D.DDL_ACCEPTANCE]}) |
|
|
i = 1 |
|
|
i = 1 |
|
|
|
|
|
|
|
|
text = utils.match_tool.compareRow(matching, header, tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"]["_data"][i], |
|
|
text = utils.match_tool.compareRow(matching, header, tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA][i], |
|
|
tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"]["_data"][i]) |
|
|
tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA][i]) |
|
|
print(text) |
|
|
print(text) |
|
|
|
|
|
|
|
|
def test_compareRows(self): |
|
|
def test_compareRows(self): |
|
@ -169,8 +175,8 @@ class MyTestCase(unittest.TestCase): |
|
|
basic.componentHandling.comps["component"] = comp |
|
|
basic.componentHandling.comps["component"] = comp |
|
|
matching = self.getMatching() |
|
|
matching = self.getMatching() |
|
|
comp.name = "component" |
|
|
comp.name = "component" |
|
|
matching.sideA = tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"]["_data"] |
|
|
matching.sideA = tdata[M.MATCH_SIDE_PREACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA] |
|
|
matching.sideB = tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"]["_data"] |
|
|
matching.sideB = tdata[M.MATCH_SIDE_POSTACTUAL]["data"]["database"]["scheme"]["table"][B.DATA_NODE_DATA] |
|
|
linksA = {"a0001": "b0001", "a0002": "b0002" } |
|
|
linksA = {"a0001": "b0001", "a0002": "b0002" } |
|
|
matching.linksA = linksA |
|
|
matching.linksA = linksA |
|
|
text = utils.match_tool.compareRows(matching, ":database:scheme:table:_data") |
|
|
text = utils.match_tool.compareRows(matching, ":database:scheme:table:_data") |
|
|