|
|
@ -25,35 +25,35 @@ MATCH_SIDE_POSTEXPECT = "postexpect" |
|
|
|
MATCH_DICT_POSTEXPECT = { |
|
|
|
"short": "SN", |
|
|
|
"long": "Soll-Nachher", |
|
|
|
"filepattern": "rsprecond" |
|
|
|
"filepattern": "rspostcond" |
|
|
|
} |
|
|
|
MATCH_SIDE_PREACTUAL = "preactual" |
|
|
|
""" it implies the precondition of the actual execution """ |
|
|
|
MATCH_DICT_PREACTUAL = { |
|
|
|
"short": "IV", |
|
|
|
"long": "Ist-Vorher", |
|
|
|
"filepattern": "rsprecond" |
|
|
|
"filepattern": "tcprecond" |
|
|
|
} |
|
|
|
MATCH_SIDE_POSTACTUAL = "postactual" |
|
|
|
""" it implies the postondition of the actual execution - it is the result """ |
|
|
|
MATCH_DICT_POSTACTUAL = { |
|
|
|
"short": "IN", |
|
|
|
"long": "Ist-Nachher", |
|
|
|
"filepattern": "rsprecond" |
|
|
|
"filepattern": "tcpostcond" |
|
|
|
} |
|
|
|
MATCH_SIDE_PRESTEP = "prestep" |
|
|
|
MATCH_SIDE_PRESTEP = "preside" |
|
|
|
""" it implies the postcondition of a preceding step of the actual execution - the preceding step must be configured in the component""" |
|
|
|
MATCH_DICT_PRESTEP = { |
|
|
|
"short": "VS", |
|
|
|
"long": "Vorhergehender Schritt (Nachher)", |
|
|
|
"filepattern": "rsprecond" |
|
|
|
"filepattern": "rspostcond" |
|
|
|
} |
|
|
|
MATCH_SIDE_TESTCASE = "testexample" |
|
|
|
""" it implies the postcondition of an exemplary testcase - the exemplary testcase must be parametrized """ |
|
|
|
MATCH_DICT_TESTCASE = { |
|
|
|
"short": "VT", |
|
|
|
"long": "Vergleichstestfall (Nachher)", |
|
|
|
"filepattern": "rsprecond" |
|
|
|
"filepattern": "rspostcond" |
|
|
|
} |
|
|
|
MATCH_SIDES = [MATCH_SIDE_PREEXPECT, MATCH_SIDE_POSTEXPECT, MATCH_SIDE_PREACTUAL, MATCH_SIDE_POSTACTUAL, MATCH_SIDE_PRESTEP, MATCH_SIDE_TESTCASE] |
|
|
|
|
|
|
@ -78,10 +78,6 @@ MATCH = { |
|
|
|
MATCH_PRECOND: { |
|
|
|
"A": MATCH_SIDE_PREEXPECT, |
|
|
|
"B": MATCH_SIDE_PREACTUAL, |
|
|
|
"shortA": "SV", |
|
|
|
"shortB": "IV", |
|
|
|
"longA": "Soll-Vorher", |
|
|
|
"longB": "Ist-Vorher", |
|
|
|
"mode": "info", |
|
|
|
"filename": "01_Vorbedingungen", |
|
|
|
"title": "Pruefung Vorbedingung (Soll-Vorher - Ist-Vorher)" |
|
|
@ -89,10 +85,6 @@ MATCH = { |
|
|
|
MATCH_POSTCOND: { |
|
|
|
"A": MATCH_SIDE_POSTEXPECT, |
|
|
|
"B": MATCH_SIDE_POSTACTUAL, |
|
|
|
"shortA": "SN", |
|
|
|
"shortB": "IN", |
|
|
|
"longA": "Soll-Nachher", |
|
|
|
"longB": "Ist-Nachher", |
|
|
|
"mode": "hard", |
|
|
|
"filename": "00_Fachabgleich", |
|
|
|
"title": "Fachliche Auswertung (Soll-Nachher - Ist-Nachher)" |
|
|
@ -100,10 +92,6 @@ MATCH = { |
|
|
|
MATCH_SUCCESS: { |
|
|
|
"A": MATCH_SIDE_PREACTUAL, |
|
|
|
"B": MATCH_SIDE_POSTACTUAL, |
|
|
|
"shortA": "IV", |
|
|
|
"shortB": "IN", |
|
|
|
"longA": "Ist-Vorher", |
|
|
|
"longB": "Ist-Nachher", |
|
|
|
"mode": "action", |
|
|
|
"filename": "04_Ablauf", |
|
|
|
"title": "Ablauf-Differenz (Ist-Vorher - Ist-Nachher)" |
|
|
@ -111,10 +99,6 @@ MATCH = { |
|
|
|
MATCH_PRESTEP: { |
|
|
|
"A": MATCH_SIDE_PRESTEP, |
|
|
|
"B": MATCH_SIDE_POSTACTUAL, |
|
|
|
"shortA": "VS", |
|
|
|
"shortB": "IN", |
|
|
|
"longA": "Vor-Schritt", |
|
|
|
"longB": "Ist-Nachher", |
|
|
|
"mode": "action", |
|
|
|
"filename": "02_Vorschritt", |
|
|
|
"title": "Schritt-Differenz (Vorschritt-Nachher - Ist-Nachher)" |
|
|
@ -122,10 +106,6 @@ MATCH = { |
|
|
|
MATCH_TESTEXAMPLE: { |
|
|
|
"A": MATCH_SIDE_TESTCASE, |
|
|
|
"B": MATCH_SIDE_POSTACTUAL, |
|
|
|
"shortA": "VS", |
|
|
|
"shortB": "IN", |
|
|
|
"longA": "Vor-Schritt", |
|
|
|
"longB": "Ist-Nachher", |
|
|
|
"mode": "action", |
|
|
|
"filename": "03_Vergleichstestfall", |
|
|
|
"title": "Schritt-Differenz (Vorschritt-Nachher - Ist-Nachher)" |
|
|
@ -136,7 +116,7 @@ class Matching(): |
|
|
|
def __init__(self, comp): |
|
|
|
self.comp = comp |
|
|
|
self.elements = {} |
|
|
|
self.matchfiles = comp.files |
|
|
|
self.matchfiles = {} |
|
|
|
self.assignedFiles = {} |
|
|
|
self.linksA = {} |
|
|
|
self.linksB = {} |
|
|
@ -147,6 +127,7 @@ class Matching(): |
|
|
|
self.sideB = [] |
|
|
|
self.mode = "" |
|
|
|
self.matchtype = "" |
|
|
|
self.cssClass = "result0" |
|
|
|
|
|
|
|
def setData(self, tdata, match): |
|
|
|
""" |
|
|
@ -155,20 +136,28 @@ class Matching(): |
|
|
|
:param match: kind of actual match |
|
|
|
:return: |
|
|
|
""" |
|
|
|
self.sideA = tdata[MATCH[match]["A"]]["data"] |
|
|
|
self.sideB = tdata[MATCH[match]["B"]]["data"] |
|
|
|
self.matchfiles["A"] = tdata[MATCH[match]["A"]]["path"] |
|
|
|
self.matchfiles["B"] = tdata[MATCH[match]["B"]]["path"] |
|
|
|
sideA = MATCH[match]["A"] |
|
|
|
sideB = MATCH[match]["B"] |
|
|
|
self.sideA = tdata[sideA]["data"] |
|
|
|
self.sideB = tdata[sideB]["data"] |
|
|
|
self.matchfiles["A"] = tdata[sideA]["path"] |
|
|
|
self.matchfiles["B"] = tdata[sideB]["path"] |
|
|
|
self.matchtype = match |
|
|
|
self.mode = MATCH[match]["mode"] |
|
|
|
self.setDiffHeader() |
|
|
|
self.report = utils.report_tool.Report.getInstance() |
|
|
|
self.resetHits() |
|
|
|
|
|
|
|
def resetHits(self): |
|
|
|
self.linksA = {} |
|
|
|
self.linksB = {} |
|
|
|
self.nomatch = {} |
|
|
|
self.matchkeys = {} |
|
|
|
self.cssClass = "result0" |
|
|
|
|
|
|
|
def setCssClass(self, cssClass): |
|
|
|
if cssClass > self.cssClass: |
|
|
|
self.cssClass = cssClass |
|
|
|
|
|
|
|
def isHitA(self, key): |
|
|
|
return ((key in self.linksA) and (self.linksA[key] != "null")) |
|
|
@ -206,8 +195,8 @@ class Matching(): |
|
|
|
htmltxt += "</head>" |
|
|
|
htmltxt += "<body>" |
|
|
|
htmltxt += "<h1>"+MATCH[matching.matchtype]["title"]+"</h1>" |
|
|
|
htmltxt += "<h4>" + MATCH[matching.matchtype]["longA"] +": " + matching.matchfiles["A"] + "</h4>" |
|
|
|
htmltxt += "<h4>" + MATCH[matching.matchtype]["longB"] +": " + matching.matchfiles["B"] + "</h4><br>" |
|
|
|
htmltxt += "<h4>"+MATCH[MATCH[matching.matchtype]["A"]]["long"]+": "+matching.matchfiles["A"]+"</h4>" |
|
|
|
htmltxt += "<h4>"+MATCH[MATCH[matching.matchtype]["B"]]["long"]+": "+matching.matchfiles["B"]+"</h4><br>" |
|
|
|
matching.htmltext = htmltxt |
|
|
|
|
|
|
|
def setDiffFooter(self): |
|
|
@ -235,6 +224,7 @@ def matchBestfit(matching, path): |
|
|
|
:param matching: |
|
|
|
:return: |
|
|
|
""" |
|
|
|
# initialize all potential links with null |
|
|
|
i=0 |
|
|
|
if (matching.sideA is not None): |
|
|
|
for r in matching.sideA: |
|
|
@ -249,11 +239,15 @@ def matchBestfit(matching, path): |
|
|
|
i += 1 |
|
|
|
ia = 0 |
|
|
|
ix = 1 |
|
|
|
# CASE: one side is None |
|
|
|
if (matching.sideA is None) or (matching.sideB is None): |
|
|
|
return |
|
|
|
# CASE: to match |
|
|
|
for rA in matching.sideA: |
|
|
|
ib = 0 |
|
|
|
for rB in matching.sideB: |
|
|
|
if (matching.isHitA(composeKey("a", ia))): |
|
|
|
continue |
|
|
|
if (matching.isHitB(composeKey("b", ib))): |
|
|
|
ib += 1 |
|
|
|
continue |
|
|
@ -374,10 +368,10 @@ def getEvaluation(matching, type, acceptance, sideA, sideB): |
|
|
|
verify = int(job.getDebugLevel("match_tool"))-1 |
|
|
|
job.debug(verify, "getEvaluation "+str(sideA)+" ?= "+str(sideB)) |
|
|
|
match = getStringSimilarity(str(sideA), str(sideB)) |
|
|
|
classA = "black" |
|
|
|
classB = "black" |
|
|
|
classA = "novalue" |
|
|
|
classB = "novalue" |
|
|
|
result = "test" |
|
|
|
if match == "99": return ["MATCH", "black", "black", "black", "black"] |
|
|
|
if match == "99": return ["MATCH", "novalue", "novalue", "novalue", "novalue"] |
|
|
|
if acceptance == "ignore": result = "ignore" |
|
|
|
if (matching.matchtype == MATCH_POSTCOND) and (result == "test"): |
|
|
|
result = "hard" |
|
|
@ -398,7 +392,7 @@ def matchDict(matching, A, B, path): |
|
|
|
job.debug(verify, "matchDict 400 " + k + ".") |
|
|
|
if k in ["_match"]: |
|
|
|
continue |
|
|
|
if (B is not None) and (B[k]): |
|
|
|
if (B is not None) and (k in B): |
|
|
|
if (isinstance(A[k], dict)): A[k]["_match"] = "Y" |
|
|
|
if (isinstance(B[k], dict)): B[k]["_match"] = "Y" |
|
|
|
job.debug(verify, "matchDict 404 " + k + "." + path) |
|
|
@ -412,7 +406,7 @@ def matchDict(matching, A, B, path): |
|
|
|
job.debug(verify, "matchDict 412 " + k + ".") |
|
|
|
if k in ["_match"]: |
|
|
|
continue |
|
|
|
if (A is not None) and (A[k]): |
|
|
|
if (A is not None) and (k in A): |
|
|
|
continue |
|
|
|
elif (A is None) or (k not in A): |
|
|
|
if (A is not None) and (isinstance(A[k], dict)): B[k]["_match"] = "N" |
|
|
@ -467,9 +461,11 @@ def compareRows(matching, path): |
|
|
|
matching.sideB[int(extractKeyI(matching.linksA[k]))]) |
|
|
|
else: |
|
|
|
htmltext += markRow(matching, header, matching.sideA[int(extractKeyI(k))], "A") |
|
|
|
matching.setCssClass("result3") |
|
|
|
for k in sorted(matching.linksB): |
|
|
|
if (not matching.isHitB(k)): |
|
|
|
htmltext += markRow(matching, header, matching.sideB[int(extractKeyI(k))], "B") |
|
|
|
matching.setCssClass("result2") |
|
|
|
htmltext += "</table>" |
|
|
|
matching.difftext += "</table>" |
|
|
|
return htmltext |
|
|
@ -480,15 +476,20 @@ def markRow(matching, header, row, side): |
|
|
|
text = "" |
|
|
|
cssClass = "" |
|
|
|
for f in header: |
|
|
|
if side == "A": |
|
|
|
if not f["field"] in row: |
|
|
|
val = "" |
|
|
|
cssClass = "novalue" |
|
|
|
elif side == "A": |
|
|
|
res = getEvaluation(matching, f["type"], f["acceptance"], row[f["field"]], "") |
|
|
|
val = str(row[f["field"]]) |
|
|
|
cssClass = res[1] |
|
|
|
else: |
|
|
|
res = getEvaluation(matching, f["type"], f["acceptance"], "", row[f["field"]]) |
|
|
|
val = str(row[f["field"]]) |
|
|
|
cssClass = res[2] |
|
|
|
text += "<td "+utils.css_tool.getInlineStyle("diffFiles", cssClass)+">" + str(row[f["field"]]) + "</td>" |
|
|
|
text += "<td "+utils.css_tool.getInlineStyle("diffFiles", cssClass)+">"+val+"</td>" |
|
|
|
text = "<tr><td "+utils.css_tool.getInlineStyle("diffFiles", cssClass)+">" \ |
|
|
|
+ MATCH[matching.matchtype]["short"+side] + "</td>" + text + "</tr>" |
|
|
|
+ MATCH[MATCH[matching.matchtype][side]]["short"] + "</td>"+text+"</tr>" |
|
|
|
matching.difftext += text |
|
|
|
return text |
|
|
|
|
|
|
@ -500,26 +501,51 @@ def compareRow(matching, header, rA, rB): |
|
|
|
textA = "" |
|
|
|
textB = "" |
|
|
|
text = "" |
|
|
|
valA = "" |
|
|
|
valB = "" |
|
|
|
classA = "novalue" |
|
|
|
classB = "novalue" |
|
|
|
for f in header: |
|
|
|
print(f) |
|
|
|
res = getEvaluation(matching, f["type"], f["acceptance"], rA[f["field"]], rB[f["field"]]) |
|
|
|
match = res[0] |
|
|
|
classA = res[1] |
|
|
|
classB = res[2] |
|
|
|
if f["field"] in rA and f["field"] in rB: |
|
|
|
res = getEvaluation(matching, f["type"], f["acceptance"], rA[f["field"]], rB[f["field"]]) |
|
|
|
match = res[0] |
|
|
|
classA = res[1] |
|
|
|
classB = res[2] |
|
|
|
valA = str(rA[f["field"]]) |
|
|
|
valB = str(rB[f["field"]]) |
|
|
|
elif f["field"] in rA : |
|
|
|
valA = str(rA[f["field"]]) |
|
|
|
match = "ddl" |
|
|
|
classA = "acceptA" |
|
|
|
classB = "acceptB" |
|
|
|
elif f["field"] in rB: |
|
|
|
valB = str(rB[f["field"]]) |
|
|
|
match = "ddl" |
|
|
|
classA = "acceptA" |
|
|
|
classB = "acceptB" |
|
|
|
else: |
|
|
|
match = "MATCH" |
|
|
|
classA = "acceptA" |
|
|
|
classB = "acceptB" |
|
|
|
if (match == "MATCH"): |
|
|
|
textA += "<td>"+str(rA[f["field"]])+"</td>" |
|
|
|
textB += "<td>"+str(rB[f["field"]])+"</td>" |
|
|
|
textA += "<td>"+valA+"</td>" |
|
|
|
textB += "<td>"+valB+"</td>" |
|
|
|
matching.setCssClass("result1") |
|
|
|
elif (match == "hard"): |
|
|
|
allident = False |
|
|
|
textA += "<td "+utils.css_tool.getInlineStyle("diffFiles", classA)+">" + str(rA[f["field"]]) + "</td>" |
|
|
|
textB += "<td "+utils.css_tool.getInlineStyle("diffFiles", classB)+">" + str(rB[f["field"]]) + "</td>" |
|
|
|
textA += "<td "+utils.css_tool.getInlineStyle("diffFiles", classA)+">"+valA+"</td>" |
|
|
|
textB += "<td "+utils.css_tool.getInlineStyle("diffFiles", classB)+">"+valB+"</td>" |
|
|
|
matching.setCssClass("result3") |
|
|
|
else: |
|
|
|
allident = False |
|
|
|
textA += "<td "+utils.css_tool.getInlineStyle("diffFiles", classA)+">"+str(rA[f["field"]])+" ("+match+")</td>" |
|
|
|
textB += "<td "+utils.css_tool.getInlineStyle("diffFiles", classB)+">"+str(rB[f["field"]])+" ("+match+")</td>" |
|
|
|
textA += "<td "+utils.css_tool.getInlineStyle("diffFiles", classA)+">"+valA+" ("+match+")</td>" |
|
|
|
textB += "<td "+utils.css_tool.getInlineStyle("diffFiles", classB)+">"+valB+" ("+match+")</td>" |
|
|
|
matching.setCssClass("result1") |
|
|
|
if allident: |
|
|
|
return "<tr><td/>"+textA+"</tr>" |
|
|
|
text = "<tr><td>"+MATCH[matching.matchtype]["shortA"]+"</td>"+textA+"</tr><tr><td>"+MATCH[matching.matchtype]["shortB"]+"</td>"+textB+"</tr>" |
|
|
|
text = "<tr><td>"+MATCH[MATCH[matching.matchtype]["A"]]["short"]+"</td>"+textA+"</tr>" |
|
|
|
text += "<tr><td>"+MATCH[matching.matchtype]["shortB"]+"</td>"+textB+"</tr>" |
|
|
|
matching.difftext += text |
|
|
|
return text |
|
|
|
|
|
|
|