Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
2.1 KiB

3 years ago
# functions about connections to other instances
# -------------------------------------------------------------------
"""
"""
3 years ago
import basic.program
3 years ago
import utils.config_tool
import basic.constants as B
3 years ago
def getConnection(comp, nr):
3 years ago
job = basic.program.Job.getInstance()
3 years ago
verify = job.getDebugLevel("conn_tool")
conn = {}
if job.conf.confs.get("tools").get("connsrc") == D.DFILE_TYPE_YML:
3 years ago
conn = utils.config_tool.getConfig("tool", "conn")
3 years ago
xtypes = None
if ("types" in conn["env"][comp]):
xtypes = conn["env"][comp]["types"]
3 years ago
instnr = "inst" + str(nr)
if conn["env"][comp][instnr]:
3 years ago
if (xtypes is not None):
conn["env"][comp][instnr]["types"] = xtypes
3 years ago
return conn["env"][comp][instnr]
else:
job.m.setFatal("Conn-Tool: Comp not configured " + comp + " " + str(nr))
3 years ago
elif job.conf.confs.get("tools").get("connsrc") == "flaskdb":
3 years ago
pass
elif job.conf.confs.get("tools").get("connsrc") == D.DFILE_TYPE_CSV:
3 years ago
pass
return None
3 years ago
def getConnections(comp):
3 years ago
job = basic.program.Job.getInstance()
3 years ago
verify = job.getDebugLevel("conn_tool")
print("getConnections " + comp)
conn = {}
conns = []
if job.conf.confs.get("tools").get("connsrc") == D.DFILE_TYPE_YML:
3 years ago
conn = utils.config_tool.getConfig("tool", "conn")
if not comp in conn["env"]:
job.m.setFatal("Conn-Tool: Comp not configured " + comp)
3 years ago
elif job.conf.confs.get("tools").get("connsrc") == "flaskdb":
3 years ago
pass
elif job.conf.confs.get("tools").get("connsrc") == D.DFILE_TYPE_CSV:
3 years ago
pass
#print(comp)
#print(conn["env"].keys())
#print(conn["env"][comp][B.SUBJECT_INST])
3 years ago
xtypes = None
if ("types" in conn["env"][comp]):
xtypes = conn["env"][comp]["types"]
for i in range(conn["env"][comp][B.SUBJECT_INST]):
print("range " + str(i + 1))
instnr = "inst" + str(i + 1)
3 years ago
if (xtypes is not None):
conn["env"][comp][instnr]["types"] = xtypes
3 years ago
conns.append(conn["env"][comp][instnr])
return conns