Browse Source

application

refactor
Ulrich 2 years ago
parent
commit
b6f822c375
  1. 109
      basic/DATASTRUCTURE.yml
  2. 2
      basic/application.py
  3. 33
      basic/program.py
  4. 2
      utils/config_tool.py

109
basic/DATASTRUCTURE.yml

@ -66,6 +66,22 @@ ap_component:
field: component field: component
index: I index: I
type: str type: str
ap_application:
_header:
- apappid
- apid
- application
apappid:
field: apappid
type: pk
apid:
field: apid
index: I
type: int
application:
field: component
index: I
type: str
ap_project: ap_project:
_header: _header:
- approid - approid
@ -90,9 +106,9 @@ ap_project:
reference: reference:
field: reference field: reference
type: str type: str
component: environment:
_header: _header:
- coid - enid
- name - name
- description - description
- reference - reference
@ -104,8 +120,8 @@ component:
- updauthor - updauthor
- updtime - updtime
- actual - actual
coid: enid:
field: apid field: enid
type: pk type: pk
name: name:
field: name field: name
@ -142,36 +158,50 @@ component:
field: actual field: actual
index: I index: I
type: int type: int
en_project:
connection:
_header: _header:
- coid - enproid
- environment - enid
- project
enproid:
field: enproid
type: pk
enid:
field: enid
index: I
type: int
project:
field: project
index: I
type: str
en_component:
_header:
- encomid
- enid
- component - component
- instance
- type - type
- ip - ip
- port - port
- hostname - hostname
- dompath - dompath
- user
- password
- attributes - attributes
- inscommit encomid:
- insauthor field: encomid
- instime
- updcommit
- updauthor
- updtime
- actual
cnid:
field: cnid
type: pk type: pk
environment: enid:
field: environment field: enid
index: I index: I
type: str type: int
component: component:
field: component field: component
index: I index: I
type: string type: str
instance:
field: instance
type: int
type: type:
field: type field: type
type: str type: str
@ -187,6 +217,42 @@ connection:
dompath: dompath:
field: dompath field: dompath
type: str type: str
user:
field: user
type: str
password:
field: password
type: str
attributes:
field: attributes
type: string
component:
_header:
- coid
- name
- description
- reference
- attributes
- inscommit
- insauthor
- instime
- updcommit
- updauthor
- updtime
- actual
coid:
field: apid
type: pk
name:
field: name
index: I
type: str
description:
field: description
type: string
reference:
field: reference
type: str
attributes: attributes:
field: attributes field: attributes
type: string type: string
@ -212,3 +278,4 @@ connection:
field: actual field: actual
index: I index: I
type: int type: int

2
basic/application.py

@ -76,7 +76,7 @@ def getEnvironments(job, projectList):
if os.path.exists(pathname): if os.path.exists(pathname):
doc = utils.file_tool.readFileDict(job, pathname, job.m) doc = utils.file_tool.readFileDict(job, pathname, job.m)
print(str(doc)) print(str(doc))
for proj in doc["env"]["general"][B.SUBJECT_PROJECTS]: for proj in doc[B.SUBJECT_ENV][B.CONF_NODE_GENERAL][B.SUBJECT_PROJECTS]:
if proj in projectList: if proj in projectList:
projects[proj][B.SUBJECT_ENV].append(envdir) projects[proj][B.SUBJECT_ENV].append(envdir)
return projects return projects

33
basic/program.py

@ -23,6 +23,9 @@ import test.constants as T
import utils.path_const as P import utils.path_const as P
import utils.job_tool import utils.job_tool
LIMIT_INFO = 16 #basic.message.LIMIT_INFO
LIMIT_DEBUG = 12 #basic.message.LIMIT_DEBUG
jobdef = { jobdef = {
"webflask": { "webflask": {
"pardef": "", "pardef": "",
@ -30,7 +33,7 @@ jobdef = {
"pfiletarget": "", "pfiletarget": "",
"basedir": "workbase", "basedir": "workbase",
"dirname": "workdir", "dirname": "workdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.conf.data}/workspace/webflask_{job.start:H}.txt" }, "logpath": "{job.conf.data}/workspace/webflask_{job.start:H}.txt" },
"declare_result": { "declare_result": {
"pardef": "", "pardef": "",
@ -38,7 +41,7 @@ jobdef = {
"pfiletarget": "", "pfiletarget": "",
"basedir": "workbase", "basedir": "workbase",
"dirname": "workdir", "dirname": "workdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.conf.data}/workspace/reorg_{job.start:H}.txt" }, "logpath": "{job.conf.data}/workspace/reorg_{job.start:H}.txt" },
"service": { "service": {
"pardef": "", "pardef": "",
@ -46,7 +49,7 @@ jobdef = {
"pfiletarget": "", "pfiletarget": "",
"basedir": "workbase", "basedir": "workbase",
"dirname": "workdir", "dirname": "workdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.conf.data}/workspace/service_{job.start:H}.txt" }, "logpath": "{job.conf.data}/workspace/service_{job.start:H}.txt" },
"unit": { "unit": {
"pardef": "", "pardef": "",
@ -54,7 +57,7 @@ jobdef = {
"pfiletarget": "", "pfiletarget": "",
"basedir": "workbase", "basedir": "workbase",
"dirname": "workdir", "dirname": "workdir",
"loglevel": basic.message.LIMIT_DEBUG, "loglevel": LIMIT_DEBUG,
"logpath": "{job.conf.data}/workspace/unittest_{job.start:H}.txt" }, "logpath": "{job.conf.data}/workspace/unittest_{job.start:H}.txt" },
"check_environment": { "check_environment": {
"pardef": "", "pardef": "",
@ -62,7 +65,7 @@ jobdef = {
"pfiletarget": "envparfile", "pfiletarget": "envparfile",
"basedir": "envbase", "basedir": "envbase",
"dirname": "envdir", "dirname": "envdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.envdir}/{log}/log_{job.start}.txt" }, "logpath": "{job.par.envdir}/{log}/log_{job.start}.txt" },
"test_executer": { "test_executer": {
"pardef": "", "pardef": "",
@ -70,7 +73,7 @@ jobdef = {
"pfiletarget": "tsparfile", "pfiletarget": "tsparfile",
"basedir": "tsbase", "basedir": "tsbase",
"dirname": "tsdir", "dirname": "tsdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tsdir}/{log}/{job.program}_{job.start}.txt" }, "logpath": "{job.par.tsdir}/{log}/{job.program}_{job.start}.txt" },
"init_testsuite": { "init_testsuite": {
"pardef": "tsdir", # ,tdtyp,tdsrc,tdname", "pardef": "tsdir", # ,tdtyp,tdsrc,tdname",
@ -78,7 +81,7 @@ jobdef = {
"pfiletarget": "tsparfile", "pfiletarget": "tsparfile",
"basedir": "tsbase", "basedir": "tsbase",
"dirname": "tsdir", "dirname": "tsdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tsdir}/{log}/{job.program}_{job.start}.txt" }, "logpath": "{job.par.tsdir}/{log}/{job.program}_{job.start}.txt" },
"init_testcase": { "init_testcase": {
"pardef": "tcdir", # ",tdtyp,tdsrc,tdname", "pardef": "tcdir", # ",tdtyp,tdsrc,tdname",
@ -86,7 +89,7 @@ jobdef = {
"pfiletarget": "tcparfile", "pfiletarget": "tcparfile",
"basedir": "tcbase", "basedir": "tcbase",
"dirname": "tcdir", "dirname": "tcdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" }, "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" },
"execute_testcase": { "execute_testcase": {
"pardef": "tcdir", # ",tdtyp,tdsrc,tdname", "pardef": "tcdir", # ",tdtyp,tdsrc,tdname",
@ -94,7 +97,7 @@ jobdef = {
"pfiletarget": "tcparfile", "pfiletarget": "tcparfile",
"basedir": "tcbase", "basedir": "tcbase",
"dirname": "tcdir", "dirname": "tcdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" }, "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" },
"collect_testcase": { "collect_testcase": {
"pardef": "tcdir", # ",tdtyp,tdsrc,tdname", "pardef": "tcdir", # ",tdtyp,tdsrc,tdname",
@ -102,7 +105,7 @@ jobdef = {
"pfiletarget": "tcparfile", "pfiletarget": "tcparfile",
"basedir": "tcbase", "basedir": "tcbase",
"dirname": "tcdir", "dirname": "tcdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" }, "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" },
"copy_appdummy": { "copy_appdummy": {
"pardef": "tcdir", # ",tdtyp,tdsrc,tdname", "pardef": "tcdir", # ",tdtyp,tdsrc,tdname",
@ -110,7 +113,7 @@ jobdef = {
"pfiletarget": "tcparfile", "pfiletarget": "tcparfile",
"basedir": "tcbase", "basedir": "tcbase",
"dirname": "tcdir", "dirname": "tcdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"}, "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"},
"compare_testcase": { "compare_testcase": {
"pardef": "tcdir", # ",tdtyp,tdsrc,tdname", "pardef": "tcdir", # ",tdtyp,tdsrc,tdname",
@ -118,7 +121,7 @@ jobdef = {
"pfiletarget": "tcparfile", "pfiletarget": "tcparfile",
"basedir": "tcbase", "basedir": "tcbase",
"dirname": "tcdir", "dirname": "tcdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" }, "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt" },
"test_system": { "test_system": {
"pardef": "tcdir,tdtyp,tdsrc,tdname", "pardef": "tcdir,tdtyp,tdsrc,tdname",
@ -126,7 +129,7 @@ jobdef = {
"pfiletarget": "tsparfile", "pfiletarget": "tsparfile",
"basedir": "tcbase", "basedir": "tcbase",
"dirname": "tcdir", "dirname": "tcdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"}, "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"},
"finish_testcase": { "finish_testcase": {
"pardef": "tcdir", "pardef": "tcdir",
@ -134,7 +137,7 @@ jobdef = {
"pfiletarget": "tcparfile", "pfiletarget": "tcparfile",
"basedir": "tcbase", "basedir": "tcbase",
"dirname": "tcdir", "dirname": "tcdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"}, "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"},
"finish_testsuite": { "finish_testsuite": {
"pardef": "tsdir", "pardef": "tsdir",
@ -142,7 +145,7 @@ jobdef = {
"pfiletarget": "tssarfile", "pfiletarget": "tssarfile",
"basedir": "tsbase", "basedir": "tsbase",
"dirname": "tsdir", "dirname": "tsdir",
"loglevel": basic.message.LIMIT_INFO, "loglevel": LIMIT_INFO,
"logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"} "logpath": "{job.par.tcdir}/{log}/{job.program}_{job.start}.txt"}
} }

2
utils/config_tool.py

@ -26,6 +26,8 @@ CONFIG_FORMAT = [D.DFILE_TYPE_YML, D.DFILE_TYPE_JSON, D.DFILE_TYPE_CSV]
def getExistgetConfigPath(job, pathnames): def getExistgetConfigPath(job, pathnames):
for p in pathnames: for p in pathnames:
if p[-1:] == ".":
p = p[0:-1]
for format in CONFIG_FORMAT: for format in CONFIG_FORMAT:
pathname = p+"."+format pathname = p+"."+format
if os.path.exists(pathname): if os.path.exists(pathname):

Loading…
Cancel
Save