From 0cd06fa48bb6b679cf3a284f25632a785dcde4e9 Mon Sep 17 00:00:00 2001 From: Daniel Quathamer Date: Thu, 14 Sep 2023 07:26:57 +0200 Subject: [PATCH] Mask-Execution redesign in Java --- .ant-targets-build.xml | 8 + .classpath | 189 +++++++ .gitignore | 1 + .project | 24 + build.xml | 78 ++- src-modules/module/qa/conf/includes.txt | 3 + src-modules/module/qa/conf/qa.xml | 26 +- ...sk_execution_assert_result_code_setzen.sql | 207 ++++++-- .../qa_mask_execution_result_purge.sql | 7 + .../qa/etl/mask_execution/execute_masks.sql | 4 +- .../module/qa/masken/37000_felderinfo.unl | 8 +- .../qa/masken/37000_masken_felder_bez.unl | 2 + .../module/qa/masken/37000_maskeninfo.unl | 6 +- .../module/qa/masken/37020_felderinfo.unl | 4 +- .../module/qa/masken/37020_maskeninfo.unl | 34 +- .../module/qa/masken/37040_maskeninfo.unl | 23 +- .../module/qa/masken/37160_felderinfo.unl | 11 - .../qa/masken/37160_maske_system_bez.unl | 1 - .../qa/masken/37160_masken_felder_bez.unl | 8 - .../module/qa/masken/37160_maskeninfo.unl | 126 ----- .../qa/masken/37160_sachgeb_maske_bez.unl | 1 - src-modules/module/qa/qa_update.x | 9 +- .../dbtest_kern_userinfo_def.sql | 181 +++++++ .../maskentest_kern_userinfo_def.sql | 183 +++++++ .../qa/schluesseltabellen/qa_captions.unl | 0 src/de/superx/qa/bin/QaTestcaseExecutor.java | 471 ++++++++++++++++++ src/de/superx/qa/util/GetOpts.java | 155 ++++++ .../conf/edustore/db/bin/qa_execute_mask.x | 42 -- .../conf/edustore/db/bin/qa_mask_execution.x | 19 + .../edustore/db/bin/qa_tc_execution_mail.x | 2 +- superx/WEB-INF/lib/superx-qa.jar | Bin 0 -> 8105 bytes 31 files changed, 1534 insertions(+), 299 deletions(-) create mode 100644 .ant-targets-build.xml create mode 100644 .classpath create mode 100644 .gitignore create mode 100644 .project create mode 100644 src-modules/module/qa/datentabellen/qa_mask_execution_result_purge.sql delete mode 100644 src-modules/module/qa/masken/37160_felderinfo.unl delete mode 100644 src-modules/module/qa/masken/37160_maske_system_bez.unl delete mode 100644 src-modules/module/qa/masken/37160_masken_felder_bez.unl delete mode 100644 src-modules/module/qa/masken/37160_maskeninfo.unl delete mode 100644 src-modules/module/qa/masken/37160_sachgeb_maske_bez.unl create mode 100644 src-modules/module/qa/schluesseltabellen/dbtest_kern_userinfo_def.sql create mode 100644 src-modules/module/qa/schluesseltabellen/maskentest_kern_userinfo_def.sql create mode 100644 src-modules/module/qa/schluesseltabellen/qa_captions.unl create mode 100644 src/de/superx/qa/bin/QaTestcaseExecutor.java create mode 100644 src/de/superx/qa/util/GetOpts.java delete mode 100755 superx/WEB-INF/conf/edustore/db/bin/qa_execute_mask.x create mode 100755 superx/WEB-INF/conf/edustore/db/bin/qa_mask_execution.x rename src-modules/module/qa/etl/mask_execution/mask_execution_mail.x => superx/WEB-INF/conf/edustore/db/bin/qa_tc_execution_mail.x (97%) create mode 100644 superx/WEB-INF/lib/superx-qa.jar diff --git a/.ant-targets-build.xml b/.ant-targets-build.xml new file mode 100644 index 0000000..dcac0ee --- /dev/null +++ b/.ant-targets-build.xml @@ -0,0 +1,8 @@ +all +call_module_scripts_create_ant +cleanBuildPath +compileSuperx +dist +distQA +initTimestamp +module_copy_source diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..9b72810 --- /dev/null +++ b/.classpath @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..840e7d3 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/classes/ diff --git a/.project b/.project new file mode 100644 index 0000000..6ace319 --- /dev/null +++ b/.project @@ -0,0 +1,24 @@ + + + qa + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + superx-src + 2 + /home/superx/git/kern/src + + + diff --git a/build.xml b/build.xml index e9fa700..274c51f 100644 --- a/build.xml +++ b/build.xml @@ -7,17 +7,34 @@ ant -DMODULE_PATH=$QA_PFAD -DBASE_DIR=. -DWEBAPP=$WEBAPP -DMODULE=qa all So erzeugen Sie dann ein SuperX-Paket: ant -DMODULE_PATH=$QA_PFAD -DWEBAPP_DIR=$WEBAPP -DMODULE=qa dist +QA-JAR erzeugen: + +ant -DWEBAPP=$WEBAPP distQA +ant -DWEBAPP=$WEBAPP cleanBuildPath --> - + + + + + + + + + + + + + + @@ -26,15 +43,24 @@ ant -DMODULE_PATH=$QA_PFAD -DWEBAPP_DIR=$WEBAPP -DMODULE=qa dist + + + + + - + + + + + @@ -47,6 +73,13 @@ ant -DMODULE_PATH=$QA_PFAD -DWEBAPP_DIR=$WEBAPP -DMODULE=qa dist + + + + + + + @@ -62,4 +95,45 @@ ant -DMODULE_PATH=$QA_PFAD -DWEBAPP_DIR=$WEBAPP -DMODULE=qa dist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src-modules/module/qa/conf/includes.txt b/src-modules/module/qa/conf/includes.txt index 31e372b..68ef154 100644 --- a/src-modules/module/qa/conf/includes.txt +++ b/src-modules/module/qa/conf/includes.txt @@ -1,2 +1,5 @@ doku/qa_modul/qa.html WEB-INF/conf/edustore/db/bin/SQL_ENV_qa.sam +WEB-INF/conf/edustore/db/bin/qa_mask_execution.x +WEB-INF/conf/edustore/db/bin/qa_tc_execution_mail.x +WEB-INF/lib/superx-qa.jar diff --git a/src-modules/module/qa/conf/qa.xml b/src-modules/module/qa/conf/qa.xml index 39f53b5..b832487 100644 --- a/src-modules/module/qa/conf/qa.xml +++ b/src-modules/module/qa/conf/qa.xml @@ -1,6 +1,6 @@ - @@ -213,6 +213,12 @@ notnull="true"> + +CSV oder XML + + +HTML, Text, CSV oder XML + @@ -306,6 +307,13 @@ notnull="true"> Test-ID + +Untergrenze erwarteter Ergebniswert + + +Obergrenze erwarteter Ergebniswert + + @@ -766,7 +774,7 @@ parent="Qualitätssicherung">Abfragen zur Administration $QA_PFAD/masken - + Masken-Ausführung $QA_PFAD/masken @@ -973,6 +981,8 @@ format="%s"> database=""/> + diff --git a/src-modules/module/qa/datentabellen/qa_mask_execution_assert_result_code_setzen.sql b/src-modules/module/qa/datentabellen/qa_mask_execution_assert_result_code_setzen.sql index f0b2394..97b910c 100644 --- a/src-modules/module/qa/datentabellen/qa_mask_execution_assert_result_code_setzen.sql +++ b/src-modules/module/qa/datentabellen/qa_mask_execution_assert_result_code_setzen.sql @@ -21,7 +21,8 @@ <@selectintotmp -select="A.tid as qa_mask_execution_assert_result_tid, +select="1::integer as testcase_type, +A.tid as qa_mask_execution_assert_result_tid, R.tid, R.mask_execution_id, R.execution_start, @@ -35,16 +36,22 @@ E.name as execution_name, E.uniquename, E.systeminfo_id, ''::char(255) as systeminfo_id_str, +''::varchar(255) as ticket_link, E.maskeninfo_id, ''::char(255) as maskeninfo_id_str, A.mask_execution_assert_id, -null::integer as result_value_min, -null::integer as result_value_max, +null::integer as dauer, +A.assert_result_value_min as result_value_min, +A.assert_result_value_max as result_value_max, null::varchar(255) as assert_caption, -null::varchar(255)[] as fields +null::varchar(255) as assert_value_range, +null::varchar(255)[] as fields, +null::varchar(255) as nextedit, +null::varchar(255) as nextmask, +null::varchar(255) as nexttable " source="qa_mask_execution E, qa_mask_execution_result R inner join qa_mask_execution_assert_result A on (A.mask_execution_result_id=R.tid)" -target="tmp_qa_mask_execution"> +target="tmp_testcase"> -- nested in selectinto muss die where Bedingung u. ggfs. group by etc kommen where E.tid=R.mask_execution_id @@ -56,7 +63,8 @@ and A.result_code is null <@selectintotmp -select="A.tid as qa_mask_execution_assert_result_tid, +select="1::integer as testcase_type, +A.tid as qa_mask_execution_assert_result_tid, R.tid, R.mask_execution_id, R.execution_start, @@ -70,18 +78,22 @@ E.name as execution_name, E.uniquename, E.systeminfo_id, ''::char(255) as systeminfo_id_str, +''::varchar(255) as ticket_link, E.maskeninfo_id, ''::char(255) as maskeninfo_id_str, A.mask_execution_assert_id, -null::integer as result_value_min, -null::integer as result_value_max, +null::decimal(20,6) as dauer, +A.assert_result_value_min as result_value_min, +A.assert_result_value_max as result_value_max, null::varchar(255) as assert_caption, +null::varchar(255) as assert_value_range, null::varchar(255)[] as fields, ('' || E.maskeninfo_id || '&')::text as nextmask, - ('../edit/qa/qa_mask_execution_edit.jsp|tid=' || E.tid)::varchar(255) as nextedit + ('../edit/qa/qa_mask_execution_edit.jsp|tid=' || E.tid)::varchar(255) as nextedit, + ('37040&Ergebnis=' || R.tid)::varchar(255) as nexttable " source="qa_mask_execution E, qa_mask_execution_result R left outer join qa_mask_execution_assert_result A on (A.mask_execution_result_id=R.tid)" -target="tmp_qa_mask_execution"> +target="tmp_testcase"> -- nested in selectinto muss die where Bedingung u. ggfs. group by etc kommen where E.tid=R.mask_execution_id @@ -93,41 +105,34 @@ target="tmp_qa_mask_execution"> /* and E.uniquename ilike '%<>%' */ /* and date(R.execution_start) >= date_val(<>) */ /* and E.tid in (select P.mask_execution_id from qa_mask_execution2project P where P.project_id=<>) */ - /* and R.tid=<> */ + /* and 1=<> */ <@informixnolog/>; <#if SQLdialect='Postgres'> -update tmp_qa_mask_execution set result_value_min=A.result_value_min, -result_value_max=A.result_value_max, -assert_caption=coalesce(A.caption,'Zeile ' || A.rownr || ' Spalte ' || A.colnr) +update tmp_testcase set assert_caption=coalesce(A.caption,'Zeile ' || A.rownr || ' Spalte ' || A.colnr) from qa_mask_execution_assert A -where A.tid=tmp_qa_mask_execution.mask_execution_assert_id; +where A.tid=tmp_testcase.mask_execution_assert_id; <#else> --Informix Dialekt: -update tmp_qa_mask_execution set (result_value_min, - result_value_max, - assert_caption) - = ((select - A.result_value_min, - A.result_value_max, +update tmp_testcase set assert_caption=(select nvl(A.caption,'Zeile ' || A.rownr || ' Spalte ' || A.colnr) from qa_mask_execution_assert A -where A.tid=tmp_qa_mask_execution.mask_execution_assert_id -)) -where tmp_qa_mask_execution.mask_execution_assert_id in (select A.tid +where A.tid=tmp_testcase.mask_execution_assert_id +) +where tmp_testcase.mask_execution_assert_id in (select A.tid from qa_mask_execution_assert A) ; -update tmp_qa_mask_execution set result_status=2, +update tmp_testcase set result_status=2, result_status_str='Fehler' where result_code!=0; -update tmp_qa_mask_execution set result_status=0, +update tmp_testcase set result_status=0, result_status_str='Erfolg' where result_code=0 and ( @@ -137,40 +142,154 @@ and ) ; -update tmp_qa_mask_execution set result_status=1, +update tmp_testcase set result_status=1, result_status_str='Warnung' where result_status is null; +update tmp_testcase set assert_value_range=result_value_min || '-' || result_value_max; + +update tmp_testcase set dauer= +<#if SQLdialect='Postgres'> +round(extract(second from (execution_end-execution_start))::decimal,0)::decimal +<#else> +execution_end-execution_start + +; +update tmp_testcase set ticket_link=P.issue_link || TP.issue_id +from qa_mask_execution2project TP, qa_project P +where TP.mask_execution_id=tmp_testcase.mask_execution_id +and P.tid=TP.project_id +; +--nun DB-Tests: +<@selectintotmp +select=" +T.tid, +T.name, +T.uniquename, +R.execution_start, +R.execution_end, +R.result_code, +null::integer as result_status, +''::char(255) as result_status_str, +R.result_value, +T.systeminfo_id, +''::char(255) as systeminfo_id_str, +A.tid as qa_dbtest_assertion_id, +A.def_col_caption, +A.def_col_name, +A.def_col_value, +''::varchar(255) as ticket_link, + ('../edit/qa/qa_dbtest_edit.jsp|tid=' || T.tid)::varchar(255) as nextedit +" +source="qa_dbtest T, qa_dbtest_assertion A inner join qa_dbtest_result R +on (R.dbtest_assertion_id=A.tid /* and date(R.execution_start) >= date_val(<>) */ +/* and R.tid=<> */ +)" +target="tmp_qa_dbtest"> + where + T.tid=A.dbtest_id + /* and T.active=<> */ + /* and T.tid in (select P.dbtest_id from qa_dbtest2project P where P.project_id=<>) */ + /* and E.userinfo_id=<> */ + /* and T.systeminfo_id=<> */ + /* and T.name ilike '%<>%' */ + /* and T.tid=<> */ + /* and 2=<> */ + + <@informixnolog/>; + +update tmp_qa_dbtest set ticket_link=P.issue_link || TP.issue_id +from qa_dbtest2project TP, qa_project P +where TP.dbtest_id=tmp_qa_dbtest.tid +and P.tid=TP.project_id +; +update tmp_qa_dbtest set --result_status=1, +result_status_str='Warnung' + where result_code=1; +update tmp_qa_dbtest set result_status=2, + result_status_str='Fehler' + where result_code is null; +-- +update tmp_qa_dbtest set + result_status_str='Erfolg' + where result_code=0 + ; + +/* delete from tmp_qa_dbtest where result_code not in ( <>) ; */ + + + +insert into tmp_testcase(testcase_type, +systeminfo_id, +execution_name, +uniquename, +--maskeninfo_id_str, +--nextserverlink, +ticket_link, +--nextmask, +execution_start, +dauer, +assert_caption, +assert_value_range, +result_value, +result_status_str, +nexttable, +nextedit +) +select 2::integer as testcase_type, --DB-Test +systeminfo_id, +name, +uniquename, +case when ticket_link !='' then 'Ticket|' || ticket_link else '' end as ticket_link, +execution_start, +<#if SQLdialect='Postgres'> +round(extract(second from (execution_end-execution_start))::decimal,0)::integer as dauer, +<#else> +execution_end-execution_start as dauer, + +nvl(def_col_caption,def_col_name) as assert_caption, +def_col_value as assert_value_range, +result_value, +result_status_str, +'' as nexttable, +nextedit +from tmp_qa_dbtest +; + +drop table tmp_qa_dbtest; + + + <#if inEtl> update qa_mask_execution_assert_result set result_code=T.result_status -from tmp_qa_mask_execution T +from tmp_testcase T where T.qa_mask_execution_assert_result_tid=qa_mask_execution_assert_result.tid and qa_mask_execution_assert_result.result_code is null; -drop table tmp_qa_mask_execution; +drop table tmp_testcase; <#else> -/* delete from tmp_qa_mask_execution where result_status not in (<>) ; */ +/* delete from tmp_testcase where result_status not in (<>) ; */ -update tmp_qa_mask_execution set systeminfo_id_str=(select name from systeminfo S -where S.tid=tmp_qa_mask_execution.systeminfo_id); +update tmp_testcase set systeminfo_id_str=(select name from systeminfo S +where S.tid=tmp_testcase.systeminfo_id); -update tmp_qa_mask_execution set maskeninfo_id_str=(select name from maskeninfo M -where M.tid=tmp_qa_mask_execution.maskeninfo_id); +update tmp_testcase set maskeninfo_id_str=(select name from maskeninfo M +where M.tid=tmp_testcase.maskeninfo_id); <#if SQLdialect='Postgres'> -update tmp_qa_mask_execution set fields=(select array_agg(trim(F.name) || '=' || trim(S.field_value)) +update tmp_testcase set fields=(select array_agg(trim(F.name) || '=' || trim(S.field_value)) from qa_mask_field_sel S, felderinfo F where S.felderinfo_id=F.tid and S.is_active=1 -and S.mask_execution_id=tmp_qa_mask_execution.execution_id +and S.mask_execution_id=tmp_testcase.execution_id ); -update tmp_qa_mask_execution set nextmask=nextmask || array_to_string(fields,'&','') +update tmp_testcase set nextmask=nextmask || array_to_string(fields,'&','') where fields is not null; @@ -180,22 +299,18 @@ execution_name, uniquename, maskeninfo_id_str, nextmask, +ticket_link as nextserverlink, execution_start, -<#if SQLdialect='Postgres'> -round(extract(second from (execution_end-execution_start))::decimal,0)::integer as dauer, -<#else> -execution_end-execution_start as dauer, - +dauer, assert_caption, -result_value_min, -result_value_max, +assert_value_range, result_value, result_status_str, -('37040&Ergebnis=' || tid)::varchar(255) as nexttable +nexttable <#if UserIsAdmin> ,nextedit -from tmp_qa_mask_execution +from tmp_testcase order by 1,2,3,4,5,6,7; diff --git a/src-modules/module/qa/datentabellen/qa_mask_execution_result_purge.sql b/src-modules/module/qa/datentabellen/qa_mask_execution_result_purge.sql new file mode 100644 index 0000000..ce1960c --- /dev/null +++ b/src-modules/module/qa/datentabellen/qa_mask_execution_result_purge.sql @@ -0,0 +1,7 @@ + + + +--Speicherplatz sparen bei Erfolg: +update qa_mask_execution_result set result_stream=null, +result_stream_contenttype=null +where result_code=0; diff --git a/src-modules/module/qa/etl/mask_execution/execute_masks.sql b/src-modules/module/qa/etl/mask_execution/execute_masks.sql index 3e43016..919dc80 100644 --- a/src-modules/module/qa/etl/mask_execution/execute_masks.sql +++ b/src-modules/module/qa/etl/mask_execution/execute_masks.sql @@ -116,8 +116,8 @@ from tmp_result T) select 'Start Assertion: ${mask_execution_assert.tid}' from xdummy; -${shebang} echo "Start sx_transform.x -IN:$WEBAPP/WEB-INF/tmp.xml -XSL:mask_assertion.xsl -OUT:tmp_mask_assertion_result.sql -method:text -param:mask_execution_id=${mask_execution_assert.mask_execution_id},mask_execution_assert_id=${mask_execution_assert.tid},rownr=${mask_execution_assert.rownr},colnr=${mask_execution_assert.colnr}" -${shebang} sx_transform.x -IN:$WEBAPP/WEB-INF/tmp.xml -XSL:mask_assertion.xsl -OUT:tmp_mask_assertion_result.sql -method:text -param:mask_execution_id=${mask_execution_assert.mask_execution_id},mask_execution_assert_id=${mask_execution_assert.tid},rownr=${mask_execution_assert.rownr},colnr=${mask_execution_assert.colnr} +${shebang} echo "Start sx_transform.x -IN:$WEBAPP/WEB-INF/tmp.xml -XSL:mask_assertion.xsl -OUT:tmp_mask_assertion_result.sql -method:text -params:mask_execution_id=${mask_execution_assert.mask_execution_id},mask_execution_assert_id=${mask_execution_assert.tid},rownr=${mask_execution_assert.rownr},colnr=${mask_execution_assert.colnr}" +${shebang} sx_transform.x -IN:$WEBAPP/WEB-INF/tmp.xml -XSL:mask_assertion.xsl -OUT:tmp_mask_assertion_result.sql -method:text -params:mask_execution_id=${mask_execution_assert.mask_execution_id},mask_execution_assert_id=${mask_execution_assert.tid},rownr=${mask_execution_assert.rownr},colnr=${mask_execution_assert.colnr} ${shebang} DOSQL tmp_mask_assertion_result.sql diff --git a/src-modules/module/qa/masken/37000_felderinfo.unl b/src-modules/module/qa/masken/37000_felderinfo.unl index 06befbc..1c210ea 100644 --- a/src-modules/module/qa/masken/37000_felderinfo.unl +++ b/src-modules/module/qa/masken/37000_felderinfo.unl @@ -1,5 +1,7 @@ -37000^Benutzer/in^50^0^0^150^200^1^integer^200^0^1^<> select tid,nvl(name,benutzer) from userinfo order by 2;^^^ -37001^Testfall-Schlüssel^10^0^0^150^150^1^sql^50^0^0^^^^ +37000^Benutzer/in^150^0^0^150^200^1^integer^200^0^1^<> select tid,nvl(name,benutzer) from userinfo order by 2;^^^ +37001^Testfall-Schlüssel^20^0^0^150^150^1^char^50^0^0^^^^ 37002^Projekt^10^0^0^150^80^1^integer^200^0^1^<> select tid,name from qa_project where active=1 /* and systeminfo_id=<> */ order by 2;^^^ -37003^Name^20^0^0^150^150^1^sql^50^0^0^^^^ +37003^Name^60^0^0^150^150^1^char^50^0^0^^^^ 37004^Komponente^1^0^0^150^200^1^integer^200^0^1^<> select tid,name from systeminfo order by 2;^^^ +37005^Maske^40^0^0^150^80^1^integer^200^0^1^<> select tid,tid || ' - ' || name from maskeninfo /*where tid in (select S.maskeninfo_id from maske_system_bez S where S.systeminfo_id=<>) */ order by name;^^^ +37006^Testfall-Nr.^30^0^0^150^150^1^integer^50^0^0^^^^ diff --git a/src-modules/module/qa/masken/37000_masken_felder_bez.unl b/src-modules/module/qa/masken/37000_masken_felder_bez.unl index 669c7d9..a1394e3 100644 --- a/src-modules/module/qa/masken/37000_masken_felder_bez.unl +++ b/src-modules/module/qa/masken/37000_masken_felder_bez.unl @@ -3,3 +3,5 @@ 37000^37002^ 37000^37003^ 37000^37004^ +37000^37005^ +37000^37006^ diff --git a/src-modules/module/qa/masken/37000_maskeninfo.unl b/src-modules/module/qa/masken/37000_maskeninfo.unl index cd43f11..bb6f846 100644 --- a/src-modules/module/qa/masken/37000_maskeninfo.unl +++ b/src-modules/module/qa/masken/37000_maskeninfo.unl @@ -48,8 +48,9 @@ FROM maskeninfo M, qa_mask_execution E left outer join userinfo U\ on (U.tid=E.userinfo_id)\ where M.tid=E.maskeninfo_id\ /* and E.userinfo_id=<> */\ -/* and E.name ilike '%<>%' */\ -/* and E.uniquename ilike '%<>%' */\ +/* and position(<> in E.name)>0 */\ +/* and position(<> in E.uniquename)>0 */\ +/* and E.tid = <> */\ /* and E.systeminfo_id=<> */\ /* and E.maskeninfo_id=<> */\ /* and E.tid in (select P.mask_execution_id from qa_mask_execution2project P where P.project_id=<>) */\ @@ -67,7 +68,6 @@ where R.mask_execution_id=tmp_ergebnis.tid);\ \ -- update tmp_ergebnis set nextedit=trim(nextedit) || trim('&rs=' || \ --sp_get_keylist_str(<>::varchar(200),'groupinfo_id'::varchar(200),'user_group_bez'::varchar(200),'userinfo_id'::varchar(200),null,null); ) \ -/* update tmp_ergebnis set nextedit=nextedit || '&name=<>'; */ \ \ insert into tmp_ergebnis (ord,\ --tid,userinfo_id, benutzer,\ diff --git a/src-modules/module/qa/masken/37020_felderinfo.unl b/src-modules/module/qa/masken/37020_felderinfo.unl index a1e44b6..13ead80 100644 --- a/src-modules/module/qa/masken/37020_felderinfo.unl +++ b/src-modules/module/qa/masken/37020_felderinfo.unl @@ -1,10 +1,10 @@ 37020^Benutzer/in^60^0^0^150^200^1^integer^200^0^1^<> select tid,nvl(name,benutzer) from userinfo order by 2;^^^ 37021^Ausführungs-Status^0^0^0^150^80^10^integer^200^0^1^<> select 0,'Erfolgreich' from xdummy union select 1,'Warnung' from xdummy union select 2,'Fehler' from xdummy order by 1^^^ 37022^Maske^20^0^0^150^80^1^integer^200^0^1^<> select tid,name from maskeninfo /*where tid in (select S.maskeninfo_id from maske_system_bez S where S.systeminfo_id=<>) */ order by 2;^^^ -37023^Testfall-Name (Stichwort)^50^0^0^150^150^1^sql^50^0^0^^^^ +37023^Testfall-Name (Stichwort)^50^0^0^150^150^1^char^50^0^0^^^^ 37024^Komponente^10^0^0^150^200^1^integer^200^0^1^<> select tid,name from systeminfo order by 2;^^^ 37025^Nur aktive^30^0^0^150^80^1^integer^200^0^1^<> select 1,'Ja' from xdummy union select 0,'nein' from xdummy order by 1 desc;^^<>select 1,'Ja' from xdummy^ 37026^Ab Datum^40^0^0^150^80^1^date^200^0^0^ ^^<> select today()-3 from xdummy^ -37027^Testfall-Schlüssel^55^0^0^150^150^1^sql^50^0^0^^^^ +37027^Testfall-Schlüssel^55^0^0^150^150^1^char^50^0^0^^^^ 37028^Projekt^15^0^0^150^80^1^integer^200^0^1^<> select tid,name from qa_project where active=1 /* and systeminfo_id=<> */ order by 2;^^^ 37029^Testfall-Typ^1000^300^-1^170^150^1^integer^30^0^1^<> select 1,'Maskenausführung' from xdummy union select 2,'Datenbank-Test' from xdummy^^ ^ diff --git a/src-modules/module/qa/masken/37020_maskeninfo.unl b/src-modules/module/qa/masken/37020_maskeninfo.unl index 490f932..8515dd4 100644 --- a/src-modules/module/qa/masken/37020_maskeninfo.unl +++ b/src-modules/module/qa/masken/37020_maskeninfo.unl @@ -36,15 +36,19 @@ E.name as execution_name,\ E.uniquename,\ E.systeminfo_id,\ ''::char(255) as systeminfo_id_str,\ +''::varchar(255) as ticket_link,\ E.maskeninfo_id,\ ''::char(255) as maskeninfo_id_str,\ A.mask_execution_assert_id,\ null::integer as dauer,\ -null::integer as result_value_min,\ -null::integer as result_value_max,\ +A.assert_result_value_min as result_value_min,\ +A.assert_result_value_max as result_value_max,\ null::varchar(255) as assert_caption,\ null::varchar(255) as assert_value_range,\ -null::varchar(255)[] as fields\ +null::varchar(255)[] as fields,\ +null::varchar(255) as nextedit,\ +null::varchar(255) as nextmask,\ +null::varchar(255) as nexttable\ "\ source="qa_mask_execution E, qa_mask_execution_result R inner join qa_mask_execution_assert_result A on (A.mask_execution_result_id=R.tid)"\ target="tmp_testcase">\ @@ -79,8 +83,8 @@ E.maskeninfo_id,\ ''::char(255) as maskeninfo_id_str,\ A.mask_execution_assert_id,\ null::decimal(20,6) as dauer,\ -null::integer as result_value_min,\ -null::integer as result_value_max,\ +A.assert_result_value_min as result_value_min,\ +A.assert_result_value_max as result_value_max,\ null::varchar(255) as assert_caption,\ null::varchar(255) as assert_value_range,\ null::varchar(255)[] as fields, \ @@ -97,8 +101,8 @@ target="tmp_testcase">\ /* and E.maskeninfo_id=<> */\ /* and E.userinfo_id=<> */\ /* and E.systeminfo_id=<> */\ - /* and E.name ilike '%<>%' */\ - /* and E.uniquename ilike '%<>%' */\ + /* and position(<> in E.name)>0 */\ + /* and E.uniquename = <> */\ /* and date(R.execution_start) >= date_val(<>) */\ /* and E.tid in (select P.mask_execution_id from qa_mask_execution2project P where P.project_id=<>) */\ /* and 1=<> */\ @@ -108,23 +112,16 @@ target="tmp_testcase">\ \ \ <#if SQLdialect='Postgres'>\ -update tmp_testcase set result_value_min=A.result_value_min,\ -result_value_max=A.result_value_max,\ -assert_caption=coalesce(A.caption,'Zeile ' || A.rownr || ' Spalte ' || A.colnr) \ +update tmp_testcase set assert_caption=coalesce(A.caption,'Zeile ' || A.rownr || ' Spalte ' || A.colnr) \ from qa_mask_execution_assert A\ where A.tid=tmp_testcase.mask_execution_assert_id;\ <#else>\ --Informix Dialekt:\ -update tmp_testcase set (result_value_min,\ - result_value_max,\ - assert_caption) \ - = ((select \ - A.result_value_min,\ - A.result_value_max,\ +update tmp_testcase set assert_caption=(select \ nvl(A.caption,'Zeile ' || A.rownr || ' Spalte ' || A.colnr)\ from qa_mask_execution_assert A\ where A.tid=tmp_testcase.mask_execution_assert_id\ -))\ +)\ where tmp_testcase.mask_execution_assert_id in (select A.tid\ from qa_mask_execution_assert A)\ ;\ @@ -195,7 +192,8 @@ target="tmp_qa_dbtest">\ /* and T.tid in (select P.dbtest_id from qa_dbtest2project P where P.project_id=<>) */\ /* and E.userinfo_id=<> */\ /* and T.systeminfo_id=<> */\ - /* and T.name ilike '%<>%' */\ + /* and position(<> in T.name)>0 */\ + /* and T.uniquename = <> */\ /* and T.tid=<> */\ /* and 2=<> */\ \ diff --git a/src-modules/module/qa/masken/37040_maskeninfo.unl b/src-modules/module/qa/masken/37040_maskeninfo.unl index 35495d9..8dedf35 100644 --- a/src-modules/module/qa/masken/37040_maskeninfo.unl +++ b/src-modules/module/qa/masken/37040_maskeninfo.unl @@ -19,8 +19,8 @@ E.systeminfo_id,\ E.maskeninfo_id,\ ''::char(255) as maskeninfo_id_str,\ A.mask_execution_assert_id,\ -null::integer as result_value_min,\ -null::integer as result_value_max\ +A.assert_result_value_min as result_value_min,\ +A.assert_result_value_max as result_value_max\ "\ source="qa_mask_execution E, qa_mask_execution_result R left outer join qa_mask_execution_assert_result A on (A.mask_execution_result_id=R.tid)"\ target="tmp_qa_mask_execution">\ @@ -32,25 +32,6 @@ target="tmp_qa_mask_execution">\ \ <@informixnolog/>;\ \ -<#if SQLdialect='Postgres'>\ -update tmp_qa_mask_execution set result_value_min=A.result_value_min,\ -result_value_max=A.result_value_max\ -from qa_mask_execution_assert A\ -where A.tid=tmp_qa_mask_execution.mask_execution_assert_id;\ -<#else>\ ---Informix Dialekt:\ -update tmp_qa_mask_execution set (result_value_min,\ - result_value_max) \ - = ((select \ - A.result_value_min,\ - A.result_value_max\ -from qa_mask_execution_assert A\ -where A.tid=tmp_qa_mask_execution.mask_execution_assert_id\ -))\ -where tmp_qa_mask_execution.mask_execution_assert_id in (select A.tid\ -from qa_mask_execution_assert A)\ -;\ -\ \ update tmp_qa_mask_execution set result_status=2,\ result_status_str='Fehler'\ diff --git a/src-modules/module/qa/masken/37160_felderinfo.unl b/src-modules/module/qa/masken/37160_felderinfo.unl deleted file mode 100644 index 55d699d..0000000 --- a/src-modules/module/qa/masken/37160_felderinfo.unl +++ /dev/null @@ -1,11 +0,0 @@ -37160^Benutzer/in^60^0^0^150^200^1^integer^200^0^1^<> select tid,nvl(name,benutzer) from userinfo order by 2;^^^ -37161^Ausführungs-Status^0^0^0^150^80^10^integer^200^0^1^<> select 0,'Erfolgreich' from xdummy union select 1,'Warnung' from xdummy union select 2,'Fehler' from xdummy order by 1^^^ -37162^Projekt^20^0^0^150^80^1^integer^200^0^1^<> select tid,name from qa_project where active=1 /* and systeminfo_id=<> */ order by 2;^^^ -37163^Testfall-Name (Stichwort)^50^0^0^150^150^1^sql^50^0^0^^^^ -37164^Komponente^10^0^0^150^200^1^integer^200^0^1^<> select tid,name from systeminfo order by 2;^^^ -37165^Nur aktive^30^0^0^150^80^1^integer^200^0^1^<> select 1,'Ja' from xdummy union select 0,'nein' from xdummy order by 1 desc;^^<>select 1,'Ja' from xdummy^ -37166^Ab Datum^40^0^0^150^80^1^date^200^0^0^ ^^<> select today()-3 from xdummy^ -37167^Testfall^100^0^0^150^200^1^integer^200^0^1^<> select T.tid,T.name from qa_testcase T where is_active=1 \ -/* and T.tid in (select P.testcase_id from qa_testcase2project P where P.project_id=<>) */ \ -/* and T.systeminfo_id=<> */\ -order by 2^ ^ ^ diff --git a/src-modules/module/qa/masken/37160_maske_system_bez.unl b/src-modules/module/qa/masken/37160_maske_system_bez.unl deleted file mode 100644 index b71f856..0000000 --- a/src-modules/module/qa/masken/37160_maske_system_bez.unl +++ /dev/null @@ -1 +0,0 @@ -37160^260^ diff --git a/src-modules/module/qa/masken/37160_masken_felder_bez.unl b/src-modules/module/qa/masken/37160_masken_felder_bez.unl deleted file mode 100644 index d7be957..0000000 --- a/src-modules/module/qa/masken/37160_masken_felder_bez.unl +++ /dev/null @@ -1,8 +0,0 @@ -37160^37160^ -37160^37161^ -37160^37162^ -37160^37163^ -37160^37164^ -37160^37165^ -37160^37166^ -37160^37167^ diff --git a/src-modules/module/qa/masken/37160_maskeninfo.unl b/src-modules/module/qa/masken/37160_maskeninfo.unl deleted file mode 100644 index 345b01f..0000000 --- a/src-modules/module/qa/masken/37160_maskeninfo.unl +++ /dev/null @@ -1,126 +0,0 @@ -37160^Testfall-Protokoll^--Autor: D. Quathamer\ ---Datum: 2.8.2019\ ---Freemarker Template\ -<#include "SQL_lingua_franca"/>\ -<#include "SuperX_general"/>\ -\ -\ -<#assign resultValueNative="result_value::float" />\ -<#if SQLdialect='Postgres'>\ -<#assign resultValueNative="round(decval(replace(result_value,'.',',')),0) " />\ -\ -\ -\ -<@selectintotmp \ -select="\ -T.tid,\ -T.name,\ -T.uniquename,\ -R.assertion_def_col_caption,\ -R.execution_start,\ -R.execution_end,\ -R.result_code,\ -R.result_value,\ -null::integer as result_status,\ -''::char(255) as result_status_str,\ -R.result_log,\ -T.systeminfo_id,\ -''::char(255) as systeminfo_id_str,\ -''::varchar(255) as ticket_link,\ -''::varchar(255) as nexttable,\ -R.mask_execution_result_id,\ -R.dbtest_result_id\ -"\ -source="qa_testcase T inner join qa_testcase_result R on (R.testcase_id=T.tid /* and date(R.execution_start) >= date_val(<>) */)"\ -target="tmp_qa_testcase">\ - where \ - 1=1\ - /* and T.is_active=<> */\ - /* and T.tid in (select P.testcase_id from qa_testcase2project P where P.project_id=<>) */\ - /* and T.userinfo_id=<> */\ - /* and T.systeminfo_id=<> */\ - /* and T.name ilike '%<>%' */\ - /* and T.tid=<> */\ - \ - <@informixnolog/>;\ -\ -update tmp_qa_testcase set ticket_link=P.issue_link || TP.issue_id\ -from qa_testcase2project TP, qa_project P\ -where TP.testcase_id=tmp_qa_testcase.tid\ -and P.tid=TP.project_id\ -;\ -\ -update tmp_qa_testcase set nexttable='37020&Result-ID=' || mask_execution_result_id\ -where mask_execution_result_id is not null;\ -update tmp_qa_testcase set nexttable='37100&Result-ID=' || dbtest_result_id\ -where dbtest_result_id is not null;\ -\ -\ -update tmp_qa_testcase set --result_status=1,\ -result_status_str='Warnung'\ - where result_code=1;\ -update tmp_qa_testcase set result_status=2,\ - result_status_str='Fehler'\ - where result_code is null;\ --- \ -update tmp_qa_testcase set \ - result_status_str='Erfolg'\ - where result_code=0\ - ;\ -\ -/* delete from tmp_qa_testcase where result_code not in ( <> ); */\ -\ -\ -update tmp_qa_testcase set systeminfo_id_str=(select name from systeminfo S\ -where S.tid=tmp_qa_testcase.systeminfo_id);\ -\ -select systeminfo_id_str,\ -name,\ -uniquename,\ -case when ticket_link !='' then 'Ticket|' || ticket_link else '' end as nextserverlink,\ -assertion_def_col_caption,\ -execution_start,\ -<#if SQLdialect='Postgres'>\ -round(extract(second from (execution_end-execution_start))::decimal,0)::integer as dauer,\ -<#else>\ -execution_end-execution_start as dauer,\ -\ -result_value,\ -result_status_str,\ -nexttable\ -from tmp_qa_testcase\ -order by 1,2,3,4,5,6,7;^XIL List\ - drop_and_delete movable_columns sizable_columns horizontal_scrolling\ - white_space_color=COLOR_WHITE fixed_columns=2\ - min_heading_height=35\ -Column CID=0 heading_text="Komponente" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=20 text_size=100\ -Column CID=1 heading_text="Testfall" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=50 text_size=200\ -Column CID=1 heading_text="Testfall\\nSchlüssel" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=10 text_size=200\ -Column CID=1 heading_text="Ticket" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=10 text_size=200\ -Column CID=1 heading_text="Erwartung" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=20 text_size=200\ -Column CID=1 heading_text="Ausführungszeit\\nStart" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=10 text_size=200\ -Column CID=1 heading_text="Dauer\\n(Sek.)" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=10 text_size=200\ -Column CID=1 heading_text="Gefundener Wert" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=10 text_size=200\ -Column CID=1 heading_text="Ausführungsstatus" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=15 text_size=200\ -Column CID=1 heading_text="Details" center_heading\ - row_selectable col_selectable heading_platform readonly\ - width=15 text_size=200\ -@@@^^^Übersicht über das Laufzeitverhalten von Masken- und Datenbanktestfällen^drop table tmp_qa_testcase;^^1^440^360^0^1^^ diff --git a/src-modules/module/qa/masken/37160_sachgeb_maske_bez.unl b/src-modules/module/qa/masken/37160_sachgeb_maske_bez.unl deleted file mode 100644 index 26da9bb..0000000 --- a/src-modules/module/qa/masken/37160_sachgeb_maske_bez.unl +++ /dev/null @@ -1 +0,0 @@ -260^37160^ diff --git a/src-modules/module/qa/qa_update.x b/src-modules/module/qa/qa_update.x index 9c73f93..5968d9c 100755 --- a/src-modules/module/qa/qa_update.x +++ b/src-modules/module/qa/qa_update.x @@ -39,11 +39,12 @@ echo "qa-Update startet" >$QA_ERRORDAT -runAndCheck.x $QA_PFAD/etl/mask_execution "qa_mask_execution.x" EXIT_ON_ERROR SEND_ERRORMAIL SEND_LOGMAIL "QA update$MANDANTID Masken" +cd $WEBAPP/WEB-INF +qa_mask_execution.x > $QA_PFAD/L_QA_update_Masken$MANDANTID.log 2>&1 runAndCheck.x $QA_PFAD "module_etl.x qa $QA_PFAD $QA_LOAD_PFAD" EXIT_ON_ERROR SEND_ERRORMAIL SEND_LOGMAIL "QA update$MANDANTID" -cat etl/mask_execution/L_QA_update$MANDANTID.log >>$QA_PFAD/L_QA_update$MANDANTID.log +cat $QA_PFAD/L_QA_update_Masken$MANDANTID.log >>$QA_PFAD/L_QA_update$MANDANTID.log echo "---------------------------Beginn Prüfroutine-----------------------------------" >>$QA_ERRORDAT -cat $QA_PFAD/L_QA_update$MANDANTID.log >>$QA_ERRORDAT +#cat $QA_PFAD/L_QA_update$MANDANTID.log >>$QA_ERRORDAT #cat $QA_PFAD/L_qa_Test$MANDANTID.log >>$QA_ERRORDAT #pruefmail.x $QA_PFAD/L_qa_Test$MANDANTID.log $ERRORMAIL @@ -71,7 +72,7 @@ else if [ "$QA_LOGMAIL" != "" -a "$MAILPROG" != "" ] then echo "Masken-Ausführung Protokoll ausführen und versenden" - $QA_PFAD/etl/mask_execution/mask_execution_mail.x >>$QA_ERRORDAT 2>&1 + $SUPERX_DIR/db/bin/qa_tc_execution_mail.x >>$QA_ERRORDAT 2>&1 fi fi diff --git a/src-modules/module/qa/schluesseltabellen/dbtest_kern_userinfo_def.sql b/src-modules/module/qa/schluesseltabellen/dbtest_kern_userinfo_def.sql new file mode 100644 index 0000000..47b47b1 --- /dev/null +++ b/src-modules/module/qa/schluesseltabellen/dbtest_kern_userinfo_def.sql @@ -0,0 +1,181 @@ + +--freemarker template + +<#assign systeminfo_id=9 /> +<#assign sachgebiete_id=0 /> + + +<#assign projects= [ +{"uniquename":"kern_user", +"name":"Kernmodul Benutzerverwaltung", +"issue_link":"https://git.campussource.de/git/SuperX/qa/issues/" +} + ] /> + +<#assign resultsets = [ +{"uniquename":"userinfo", +"name":"Benutzeraccounts", +"fieldclause":"U.*", +"fromclause":"userinfo U", +"groupbyclause":"", +"orderbyclause":"" +} + ] /> + +<#assign dbtests = [ + { + "project":"kern_user", + "uniquename":"kern_adminuser_exists", + "name":"Benutzeraccount mit Administrationsrechten existiert", + "resultset":"userinfo", + "whereclause":"benutzer=''admin''", + "description":"", + "issue_id":"1" + } + + ] /> + + <#assign dbtest_assertions = [ + + { + "dbtest":"kern_adminuser_exists", + "rownr":"1", + "assertion_col": "benutzer", + "assertion_value": "adim", + "assertion_caption":"Admin-Account" + } + ] /> + + +--ab hier ist der Code immer gleich: +<#foreach resultset in resultsets> +insert into qa_resultset( + uniquename, + name, + systeminfo_id, + fromclause, + fieldclause, + groupbyclause, + orderbyclause) +select +'${resultset.uniquename}', +'${resultset.name}', +${systeminfo_id}, +'${resultset.fromclause}', +'${resultset.fieldclause}', +'${resultset.groupbyclause}', +'${resultset.orderbyclause}' +from xdummy +where 0=(select count(*) from qa_resultset R +where R.uniquename='${resultset.uniquename}' +and R.systeminfo_id=${systeminfo_id}) +; + + + +<#foreach project in projects> + +insert into qa_project( +uniquename, + name, + systeminfo_id, + sachgebiete_id, + active, + issue_link, + created_at, + created_from +) +select +'${project.uniquename}', +'${project.name}', +${systeminfo_id}, +${sachgebiete_id}, +1 as active, +'${project.issue_link}', +today(), +1 +from xdummy +where 0=(select count(*) from qa_project P +where P.uniquename='${project.uniquename}' +and P.systeminfo_id=${systeminfo_id}); + +<#foreach dbtest in dbtests> +<#if dbtest.project=project.uniquename> +insert into qa_dbtest( +uniquename, +name, +systeminfo_id, +resultset_id, +whereclause, +description, +active) + select '${dbtest.uniquename}', +'${dbtest.name}', +${systeminfo_id}, +(select R.tid from qa_resultset R where R.uniquename='${dbtest.resultset}' +and R.systeminfo_id=${systeminfo_id} +) as resultset_id, +'${dbtest.whereclause}', +'${dbtest.description}', +1 as active +FROM qa_project +where uniquename= '${project.uniquename}' +and systeminfo_id=${systeminfo_id} +and 0=(select count(*) from qa_dbtest T +where T.uniquename='${dbtest.uniquename}' +and T.systeminfo_id=${systeminfo_id}) +; + +insert into qa_dbtest2project( dbtest_id, +project_id, +issue_id) + select T.tid, + P.tid, +'${dbtest.issue_id}' + FROM qa_dbtest T,qa_project P + where T.uniquename='${dbtest.uniquename}' + and T.systeminfo_id=${systeminfo_id} + and P.uniquename= '${project.uniquename}' + and P.systeminfo_id=${systeminfo_id} + and 0=(select count(*) from qa_dbtest2project TP, + qa_dbtest T,qa_project P +where T.uniquename='${dbtest.uniquename}' +and T.systeminfo_id=${systeminfo_id} + and P.uniquename= '${project.uniquename}' + and P.systeminfo_id=${systeminfo_id} + and TP.project_id=P.tid + and TP.dbtest_id=T.tid) + ; +<#foreach assertion in dbtest_assertions> +<#if assertion.dbtest=dbtest.uniquename> +insert into qa_dbtest_assertion( +dbtest_id, + rownr, + def_col_caption, + def_col_name, + def_col_value + ) +select tid, +${assertion.rownr}, +'${assertion.assertion_caption}', +'${assertion.assertion_col}', +'${assertion.assertion_value}' +from qa_dbtest T +where T.uniquename='${dbtest.uniquename}' +and T.systeminfo_id=${systeminfo_id} +and 0=(select count(*) from qa_dbtest_assertion A +where A.dbtest_id=T.tid +and A.rownr=${assertion.rownr} +and A.def_col_name='${assertion.assertion_col}' +); + + + --von assertion + + + + + --von dbtest + + + diff --git a/src-modules/module/qa/schluesseltabellen/maskentest_kern_userinfo_def.sql b/src-modules/module/qa/schluesseltabellen/maskentest_kern_userinfo_def.sql new file mode 100644 index 0000000..d5f11e4 --- /dev/null +++ b/src-modules/module/qa/schluesseltabellen/maskentest_kern_userinfo_def.sql @@ -0,0 +1,183 @@ + +--freemarker template + +<#assign systeminfo_id=9 /> +<#assign sachgebiete_id=0 /> + + +<#assign projects= [ +{"uniquename":"kern_user", +"name":"Kernmodul Benutzerverwaltung", +"issue_link":"https://git.campussource.de/git/SuperX/qa/issues/" +} + ] /> + + +<#assign mask_executions = [ + { + "project":"kern_user", + "uniquename":"kern_adminuser_exists_mask", + "name":"Benutzeraccounts mit Administrationsrechten existieren", + "userinfo_id":"1", + "maskeninfo_id":"71050", + "description":"", + "issue_id":"1" + } + + ] /> +<#assign mask_execution_fields = [ + { + "mask_execution_uniquename":"kern_adminuser_exists_mask", + "felderinfo_id":"71053", + "field_value":"Admin" + } + + ] /> + <#assign mask_execution_assertions = [ + + { + "mask_execution_uniquename":"kern_adminuser_exists_mask", + "rownr":"1", + "colnr": "2", + "result_value_min": "1", + "result_value_max": "1000", + "assertion_caption":"Anzahl Admin-Accounts" + } + ] /> + + +--ab hier ist der Code immer gleich: + + +<#foreach project in projects> + +insert into qa_project( +uniquename, + name, + systeminfo_id, + sachgebiete_id, + active, + issue_link, + created_at, + created_from +) +select +'${project.uniquename}', +'${project.name}', +${systeminfo_id}, +${sachgebiete_id}, +1 as active, +'${project.issue_link}', +today(), +1 +from xdummy +where 0=(select count(*) from qa_project P +where P.uniquename='${project.uniquename}' +and P.systeminfo_id=${systeminfo_id}); + +<#foreach mask_execution in mask_executions> +<#if mask_execution.project=project.uniquename> +insert into qa_mask_execution( +uniquename, +name, +systeminfo_id, +userinfo_id, +maskeninfo_id, +--description, +is_active) + select '${mask_execution.uniquename}', +'${mask_execution.name}', +${systeminfo_id}, +${mask_execution.userinfo_id}, +${mask_execution.maskeninfo_id}, +1 as active +FROM qa_project +where uniquename= '${project.uniquename}' +and systeminfo_id=${systeminfo_id} +and 0=(select count(*) from qa_mask_execution T +where T.uniquename='${mask_execution.uniquename}' +and T.systeminfo_id=${systeminfo_id}) +; + +insert into qa_mask_execution2project( mask_execution_id, +project_id, +issue_id) + select T.tid, + P.tid, +'${mask_execution.issue_id}' + FROM qa_mask_execution T,qa_project P + where T.uniquename='${mask_execution.uniquename}' + and T.systeminfo_id=${systeminfo_id} + and P.uniquename= '${project.uniquename}' + and P.systeminfo_id=${systeminfo_id} + and 0=(select count(*) from qa_mask_execution2project TP, + qa_mask_execution T,qa_project P +where T.uniquename='${mask_execution.uniquename}' +and T.systeminfo_id=${systeminfo_id} + and P.uniquename= '${project.uniquename}' + and P.systeminfo_id=${systeminfo_id} + and TP.project_id=P.tid + and TP.mask_execution_id=T.tid) + ; + +<#foreach field in mask_execution_fields> +<#if field.mask_execution_uniquename=mask_execution.uniquename> +insert into qa_mask_field_sel( +mask_execution_id, + felderinfo_id, + field_value, + is_active + ) +select tid, +${field.felderinfo_id}, +'${field.field_value}', +1 as is_active +from qa_mask_execution T +where T.uniquename='${mask_execution.uniquename}' +and T.systeminfo_id=${systeminfo_id} +and 0=(select count(*) from qa_mask_field_sel A +where A.mask_execution_id=T.tid +and A.felderinfo_id=${field.felderinfo_id} +); + + + --von field + + + +<#foreach assertion in mask_execution_assertions> +<#if assertion.mask_execution_uniquename=mask_execution.uniquename> +insert into qa_mask_execution_assert( + mask_execution_id, + rownr, + colnr, + result_value_min, + result_value_max, + is_active, + caption + ) +select tid, +${assertion.rownr}, +${assertion.colnr}, +${assertion.result_value_min}, +${assertion.result_value_max}, +1 as is_active, +'${assertion.assertion_caption}' +from qa_mask_execution T +where T.uniquename='${mask_execution.uniquename}' +and T.systeminfo_id=${systeminfo_id} +and 0=(select count(*) from qa_mask_execution_assert A +where A.mask_execution_id=T.tid +and A.rownr=${assertion.rownr} +and A.colnr=${assertion.colnr}); + + + --von assertion + + + + + --von mask_execution + + + diff --git a/src-modules/module/qa/schluesseltabellen/qa_captions.unl b/src-modules/module/qa/schluesseltabellen/qa_captions.unl new file mode 100644 index 0000000..e69de29 diff --git a/src/de/superx/qa/bin/QaTestcaseExecutor.java b/src/de/superx/qa/bin/QaTestcaseExecutor.java new file mode 100644 index 0000000..fd800d2 --- /dev/null +++ b/src/de/superx/qa/bin/QaTestcaseExecutor.java @@ -0,0 +1,471 @@ +/* + * de.superx.qa - a package for controlling QA routines + * Copyright (C) 2023 Daniel Quathamer + * + * This package is licensed under the CampusSource License; + * http://www.campussource.de/org/license/ + */ +package de.superx.qa.bin; + +import java.io.IOException; +import java.io.StringReader; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Locale; +import java.util.Properties; + +import org.jaxen.JaxenException; +import org.jaxen.XPath; +import org.jaxen.jdom.JDOMXPath; +import org.jdom.Document; +import org.jdom.Element; +import org.jdom.JDOMException; +import org.jdom.Namespace; +import org.jdom.input.SAXBuilder; +import org.springframework.mock.web.MockHttpServletRequest; +import org.springframework.mock.web.MockHttpServletResponse; +import org.springframework.mock.web.MockServletConfig; + +import de.memtext.baseobjects.coll.NamedIdObjectList; +import de.superx.bin.SxConnection; +import de.superx.common.FieldContainer; +import de.superx.common.Maske; +import de.superx.common.SuperX_el; +import de.superx.common.SxResultRow; +import de.superx.common.SxResultSet; +import de.superx.common.SxSqlHelper; +import de.superx.common.SxUser; +import de.superx.etl.EtlUtils; +import de.superx.qa.util.GetOpts; +import de.superx.sec.InputCheckRegistry; +import de.superx.servlet.SuperXManager; +import de.superx.servlet.SxPools; +import de.superx.servlet.UserInitializer; +import de.superx.util.PathAndFileUtils; +import de.superx.util.SqlStringUtils; +import net.sf.saxon.sxpath.XPathExpression; + +public class QaTestcaseExecutor { + private static String tcUniquename; + private static String systeminfoId; + private static String fieldSelCmdLine; + private static int maskExecutionId; + private static String maskeninfoId; + private static String userName, userAdmin; + private static int userId; + private static long starttime ; + private static long endtime ; + private static String mandantenID="default"; + private static FieldContainer myFieldContainer; + private static Hashtable maskFields ; + private static String resultXml; + private static String resultLog; + private static String pathToDbProperties; + private static Connection myConnection; + + public QaTestcaseExecutor() { + this.maskFields = new Hashtable(); + } + + private void init() throws SQLException + { + + + + try { + myConnection = this.getConnection(pathToDbProperties); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + if(myConnection==null) + throw new SQLException("No connection possible "); + + + //System.out.println("fieldSel:"+fieldSel); + + System.out.println("inited"); + + } + + private static Connection getConnection(String pathToDbProperties) throws Exception { + String myDefaultPropFile=PathAndFileUtils.getWebinfDirectory()+PathAndFileUtils.PATHSEP+"db.properties"; + if(pathToDbProperties==null) + pathToDbProperties=myDefaultPropFile; + Connection myConnection; + SxConnection mySxConnection = null; + mySxConnection = new SxConnection(); + mySxConnection.setPropfile(pathToDbProperties); + + myConnection = mySxConnection.getConnection(); + + + + return myConnection; + } + + public static void main(String[] args) { + String usage="usage: java de.superx.qa.bin.QaTestcaseExecutor -dbproperties:$DB_PROPERTIES -tc:abc -systeminfo_id:9 -params:TID=16000 (optional) -outfile:Ausgabedatei (optional)" ; + GetOpts.setOpts(args); + + String isdrin = GetOpts.isAllRequiredOptionsPresent("-logger,-dbproperties"); + if (isdrin != null) { + + System.err.println(usage); + System.exit(1); + } + int returnCode=0; + int nrOfTestcases=0; + int nrOfSuccessfulTestcases=0; + pathToDbProperties = GetOpts.getValue("-dbproperties"); + String tcUniquename="" ; + if (GetOpts.isPresent("-tc")) + tcUniquename= GetOpts.getValue("-tc"); + String systeminfoId=""; + if (GetOpts.isPresent("-systeminfo_id")) + systeminfoId= GetOpts.getValue("-systeminfo_id"); + String loggerArg=GetOpts.getValue("-logger"); + + + QaTestcaseExecutor myExec=new QaTestcaseExecutor(); //TODO:Mandantid + + try { + myExec.init(); + int[] myTestcases=getTestcases(tcUniquename,systeminfoId); + nrOfTestcases=myTestcases.length; + if(nrOfTestcases>0) + { + for (int tcNr = 0;tcNr < nrOfTestcases; tcNr++) + { + returnCode=executeTestcase(myTestcases[tcNr]); + if(returnCode==0) + nrOfSuccessfulTestcases++; + } + } + myConnection.close(); + + } catch (Exception e) { + // TODO Auto-generated catch block + + e.printStackTrace(); + System.err.println(e.toString()); + System.exit(1); + } + System.out.println("Executed testcases:"+ nrOfTestcases+"; successful: "+nrOfSuccessfulTestcases); + + + System.exit(returnCode); + + } + + private static int[] getTestcases(String tcUniquename,String systeminfoId) throws Exception + { + //TODO_ Umlaute erlauben: + //if(!SqlStringUtils.checkValidKeyEntry(tcUniquename) || !SqlStringUtils.checkValidKeyEntry(systeminfoId)) + // throw new Exception("Invalid Testcase "+tcUniquename); + + String sql = "" + + "SELECT \n" + + "E.tid as mask_execution_id\n" + + "FROM qa_mask_execution E left outer join userinfo U\n" + + " on (U.tid=E.userinfo_id)" + + "where E.is_active=1"; + if(!tcUniquename.equals("")) + sql +=" and E.uniquename ='"+tcUniquename+"'"; + if(!systeminfoId.equals("")) + sql +=" and E.systeminfo_id="+systeminfoId; + sql +=" order by 1;"; + SuperX_el el = new SuperX_el(); + SxSqlHelper sh=new SxSqlHelper(); + + sh.execute(sql, myConnection, el); + if (el.getError_String() != null + && !el.getError_String().trim().equals("")) + throw new SQLException("\nProblem bei Testfall Sammlung DETAILS:" + "\n\n Meldung:" + + el.getError_String() + "\n sql:" + sql); + SxResultSet result= el.getResultSet(); + int nrOfTestcases=result.size(); + int[] testCases=new int[nrOfTestcases]; + + int rownr=0; + for (Iterator it = result.iterator(); it.hasNext();) { + SxResultRow row = (SxResultRow) it.next(); + maskExecutionId=(int) row.get(0); + testCases[rownr]=maskExecutionId; + rownr++; + } + + return testCases; + + } + private static int executeTestcase(int maskExecutionId) throws Exception + { + + int returnCode; + starttime = new java.util.Date().getTime() ; + String fieldSel=""; + String felderinfoId=""; + String felderinfoName=""; + String fieldValue=""; + String sql = "" + + "SELECT \n" + + "E.maskeninfo_id," + + "E.userinfo_id as userid," + + "U.benutzer as username," + + "S.mask_execution_id,\n" + + "S.felderinfo_id,\n" + + "trim(F.name) as felderinfo_name," + + "string_not_null(S.field_value) as field_value, \n" + + "U.administration " + + "FROM felderinfo F,qa_mask_field_sel S, qa_mask_execution E left outer join userinfo U\n" + + " on (U.tid=E.userinfo_id)" + + "where F.tid=S.felderinfo_id " + + "and E.tid=S.mask_execution_id\n" + + "and E.tid="+maskExecutionId+";"; + SuperX_el el = new SuperX_el(); + SxSqlHelper sh=new SxSqlHelper(); + + sh.execute(sql, myConnection, el); + if (el.getError_String() != null + && !el.getError_String().trim().equals("")) + throw new SQLException("\nProblem bei Testfall DETAILS:" + "\n\n Meldung:" + + el.getError_String() + "\n sql:" + sql); + SxResultSet result= el.getResultSet(); + int rownr=0; + for (Iterator it = result.iterator(); it.hasNext();) { + rownr++; + SxResultRow row = (SxResultRow) it.next(); + maskeninfoId=row.get(0).toString().trim(); + userId=(int) row.get(1); + userName=row.get(2).toString().trim(); + maskExecutionId=(int) row.get(3); + felderinfoId=row.get(4).toString().trim(); + felderinfoName=row.get(5).toString().trim(); + fieldValue=row.get(6).toString().trim(); + userAdmin=row.get(7).toString().trim(); + maskFields.put(felderinfoName,fieldValue); + } + System.out.println("Testcase "+ maskExecutionId+" initialized"); + returnCode=executeMask(); + endtime = new java.util.Date().getTime() ; + int maskExecutionResultId=saveExecutionResult(returnCode,resultLog); + if(returnCode ==0) + { + returnCode=checkAssertions(maskExecutionResultId); + + } + else + throw new Exception("Testcase error in masc execution "+maskExecutionId); + return returnCode; + } + private static int executeMask() + { + int returnCode=0; + MockHttpServletRequest mock ; + MockHttpServletResponse mockResponse = new MockHttpServletResponse(); + MockServletConfig mockServletConfig = new MockServletConfig(); + SxUser user=null; + mock = new MockHttpServletRequest(); + Enumeration fieldEnum = maskFields.keys(); + while (fieldEnum.hasMoreElements()) { + String paramName = (String) fieldEnum.nextElement(); + String paramVal= maskFields.get(paramName).toString(); + mock.addParameter(paramName, paramVal); + + } + try { + SuperXManager.initKettleEnv(); + SxPools.init(); + SxPools.get(mandantenID).init(); + SxPools.get(mandantenID).initLogging(true); + SxPools.resetAllPools(); + + user = UserInitializer.initUser(mandantenID, userName, userId, userAdmin); + + } catch (Exception e) { + System.err.println("Fehler beim Aufbau der Connection: " + e.toString()); + System.exit(1); + } + Locale desiredLocale = new Locale(de.superx.util.SqlStringUtils.getEncoding()); + SuperXManager.maxRows = 1000000; + Maske maske = null; + InputCheckRegistry.registerDefaultChecks(); + try { + maske = new Maske(mandantenID, user, new Integer(maskeninfoId), desiredLocale); + /*NamedIdObjectList fields = maske.readFelderFromDb(user); + myFieldContainer = maske.getIndividualFields(); + myFieldContainer.addAll(fields);*/ + maske.setFieldDefaults(user, mock, true); + resultXml=getResultXml(mock, mockResponse, maske, user, desiredLocale); + System.out.println("resultXml Länge " + resultXml.length() + " für Maske " + maskeninfoId + " erzeugt"); + } catch (Exception e) { + e.printStackTrace(); + resultLog="Fehler beim Ausführen der Maske " + maskeninfoId + ": " + e.toString(); + returnCode=1; + } + + return returnCode; + } + private static int checkAssertions(int maskExecutionResultId) throws Exception + { + int resultCode=0; + int assertionId,assertionRownr,assertionColnr; + Double minVal,maxVal,foundVal=null; + String sql = "select " + +"tid," + +"rownr," + +"colnr," + +"result_value_min," + +"result_value_max" + +" from qa_mask_execution_assert" + + " where is_active=1" + +" and mask_execution_id="+maskExecutionId+";"; + + + /*try { + myConnection = getConnection(pathToDbProperties); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + }*/ + if(myConnection==null) + throw new SQLException("No connection possible "); + SuperX_el el = new SuperX_el(); + SxSqlHelper sh=new SxSqlHelper(); + + sh.execute(sql, myConnection, el); + if (el.getError_String() != null + && !el.getError_String().trim().equals("")) + throw new SQLException("\nProblem bei Testfall Assertion DETAILS:" + "\n\n Meldung:" + + el.getError_String() + "\n sql:" + sql); + SxResultSet result= el.getResultSet(); + int rownr=0; + for (Iterator it = result.iterator(); it.hasNext();) { + rownr++; + SxResultRow row = (SxResultRow) it.next(); + assertionId=(Integer) row.get(0); + assertionRownr=(Integer) row.get(1); + assertionColnr=(Integer) row.get(2); + minVal=(Double) row.get(3); + maxVal=(Double) row.get(4); + try { + foundVal=getValFromXml(assertionRownr,assertionColnr); + } catch (Exception e) { + System.err.println("Testfall ID " +maskExecutionId+" mit Maskennr. "+maskeninfoId+ " Assertion-ID "+assertionId+ " kein Ergebnis "); + } + if(foundVal != null && foundVal >=minVal && foundVal<=maxVal) + { + System.out.println("Testfall ID " +maskExecutionId+" mit Maskennr. "+maskeninfoId+ " Assertion-ID "+assertionId+ " erfolgreich"); + } + else + { + resultCode=1; + System.out.println("Testfall ID " +maskExecutionId+" mit Maskennr. "+maskeninfoId+ " Assertion-ID "+assertionId+ " beendet mit Warnung/Fehler"); + } + saveAssertResult(assertionId,maskExecutionResultId,foundVal,resultCode,minVal,maxVal); + } + + //System.out.println("fieldSel:"+fieldSel); + //myConnection.close(); + return resultCode; + } + private static void saveAssertResult(int maskExecutionAssertId,int maskExecutionResultId,Double resultValue,int resultCode,double minVal,double maxVal) throws SQLException + { + String sql="insert into qa_mask_execution_assert_result(mask_execution_assert_id, mask_execution_result_id, result_code, assert_result_value_min, assert_result_value_max"; + if(resultValue==null) + sql+=") values(?,?,?,?,?)"; + else + sql +=",result_value) values(?,?,?,?,?,?);"; + PreparedStatement st=myConnection.prepareStatement(sql); + st.setInt(1,maskExecutionAssertId); + st.setInt(2,maskExecutionResultId); + st.setInt(3,resultCode); + st.setDouble(4, minVal); + st.setDouble(5, maxVal); + if(resultValue!=null) + st.setDouble(6, resultValue); + + boolean executed= st.execute(); + + } + private static int saveExecutionResult(int maskExecutionResult,String log ) throws SQLException + { + int ret=0; + java.sql.Timestamp startTimeDate = new java.sql.Timestamp(starttime); + java.sql.Timestamp endTimeDate = new java.sql.Timestamp(endtime); + String sql="insert into qa_mask_execution_result(mask_execution_id, execution_start, execution_end, result_code,result_log,result_stream,result_stream_contenttype)"; + sql +="values(?,?,?,?,?,?,?);"; + PreparedStatement st=myConnection.prepareStatement(sql); + st.setInt(1,maskExecutionId); + st.setTimestamp(2, startTimeDate); + st.setTimestamp(3, endTimeDate); + st.setInt(4,maskExecutionResult); + st.setString(5,log); + //im Fehler/Warnungsfall Ergebnis speichern: + st.setString(6,resultXml); + st.setString(7,"text/xml"); + + boolean executed= st.execute(); + //get generated tid: + sql="select currval('qa_mask_execution_result_tid_seq')::integer;"; + SuperX_el el = new SuperX_el(); + SxSqlHelper sh=new SxSqlHelper(); + sh.execute(sql, myConnection, el); + SxResultSet result= el.getResultSet(); + int rownr=0; + for (Iterator it = result.iterator(); it.hasNext();) { + rownr++; + SxResultRow row = (SxResultRow) it.next(); + ret=(Integer) row.get(0); + } + + return ret; + + } private static Double getValFromXml(int assertionRownr,int assertionColnr) throws Exception + { + Double foundval = null; + SAXBuilder builder = new SAXBuilder(); + Document doc = builder.build(new StringReader(resultXml)); + Namespace ns = doc.getRootElement().getNamespace(); + String xpathStr = "/ergebnisse/ergebnis/ergebniselement/sqlerg/row[@no="+(assertionRownr-1)+"]/col[@id="+(assertionColnr-1)+"]/wert"; + XPath expression = new JDOMXPath(xpathStr); + Element myNode = (Element) expression.selectSingleNode(doc); + if(myNode==null) + return null; + else + { + String myNodeVal=myNode.getTextNormalize(); + return foundval.parseDouble(myNodeVal); + } + + } + private static String getResultXml(MockHttpServletRequest mock_par, MockHttpServletResponse mockResponse_par, + Maske maske, SxUser user_par, Locale desiredLocale) { + String currentXml_local = null; + maske.setMaxOffset(10000000); + maske.setReuseResult(false); + maske.resetTableStylesheet(); + maske.setSelectedTableStylesheetFileAndContenttype("tabelle_xml.xsl"); + maske.setDesiredContenttype("text/xml"); + try { + currentXml_local = maske.runQuery(user_par, mock_par, null).toString(); + resultLog=("Ausgabe Maskenprotokoll\n" + SuperXManager.activityLog.toString()); + System.out.println("Maskenergebnis wird lokalisiert"); + currentXml_local = SxPools.get(mandantenID).localize(currentXml_local, desiredLocale); + + } catch (Exception e) { + resultLog="Fehler beim Erstellen des XML für Maske " + e.toString(); + System.err.println("Fehler beim Erstellen des XML für Maske " + e.toString()); + } + return currentXml_local; + + } +} + + + diff --git a/src/de/superx/qa/util/GetOpts.java b/src/de/superx/qa/util/GetOpts.java new file mode 100644 index 0000000..6aa7047 --- /dev/null +++ b/src/de/superx/qa/util/GetOpts.java @@ -0,0 +1,155 @@ +package de.superx.qa.util; + + +import java.util.StringTokenizer; + +/** + * Original von de.memtext.util.GetOpts, + * für Abwärtskompatibilität mit Kern 4.9/BI 2022.12 + * + */ +public class GetOpts { + private static String[] arguments = null; + + //don't instantiate + private GetOpts() { + + } + + /** + * If you pass the arguments you want to analyse to this static helper class + * using setOpts, you can later use the short form of the methods e.g. + * isPresent(String option) without having to pass the arguments again. + * + * @param args + */ + public static void setOpts(String args[]) { + arguments = args; + } + + /** + * checks if the arguments passed before by setOpts contain the given option + * + * @param String + * option + * @return true if arguments contain the option, i.e. one String which + * starts with the option-String + */ + public static boolean isPresent(String option) { + if (arguments == null) + throw new IllegalStateException( + "must either use setOpts before or call the long version of this method"); + return isPresent(arguments, option); + } + + /** + * checks if the arguments contain the given option + * + * @param args + * @param String + * option + * @return true if arguments contain the option, i.e. one String which + * starts with the option-String + */ + public static boolean isPresent(String args[], String option) { + boolean result = false; + for (int i = 0; i < args.length; i++) + if (args[i] != null && args[i].startsWith(option)) + result = true; + return result; + } + + /** + * Gets a named option from the arguments passed before with setOps. E.g. + * getOpt("--log") would return the "--log:true" in the arguments + * + * @param option - + * name/start of the option + * @return String whole option + */ + public static String getOpt(String option) { + if (arguments == null) + throw new IllegalStateException( + "must either use setOpts before or call the long version of this method"); + return getOpt(option, arguments); + } + + /** + * Gets a named option from the arguments. E.g. getOpt("--log") would return + * the "--log:true" in the arguments + * + * @param option - + * name/start of the option + * @return String whole option + */ + public static String getOpt(String option, String args[]) { + if (args == null) + throw new IllegalStateException("args must not be null"); + String result = null; + for (int i = 0; i < args.length; i++) + if (args[i].startsWith(option)) + result = args[i]; + if (result == null) + throw new RuntimeException("Option " + option + " not found!"); + return result; + } + + /** + * Gets the value of an option from the arguments passed before with setOpts + * if for example, you ask getValue("--log:") and the arguments passed + * before with setOpts contain a String "--log:true") "true" is returned + * + * @param String + * option + * @return String value of the option + */ + public static String getValue(String option) { + if (arguments == null) + throw new IllegalStateException( + "must either use setOpts before or call the long version of this method"); + return getValue(option, arguments); + } + + /** + * Gets the value of an option, if for example, you ask getValue("--log:") + * and the arguments passed before with setOpts contain a String + * "--log:true") "true" is returned + * + * @param String + * option + * @return String value of the option + */ + public static String getValue(String option, String args[]) { + String result = ""; + String raw = getOpt(option, args); + int pos = option.length(); + if (raw.charAt(pos) == ':') + pos++; + result = raw.substring(pos, raw.length()); + return result; + } + + /** + * Prüft, ob alle notwendigen Optionen angegeben sind, z.B. String + * "-loggingProperties:,-dbProperties" übergeben, die beiden müssen dabei + * sein + * + * @param options + * z.B. "-loggingProperties:,-dbProperties,..." + * @return null - alles OK, ansonsten String mit den fehlenden Optionen + */ + public static String isAllRequiredOptionsPresent(String options) { + String result = null; + StringTokenizer st = new StringTokenizer(options, ","); + for (; st.hasMoreTokens();) { + String optionName = st.nextToken(); + if (!isPresent(optionName)) { + if (result == null) + result = optionName; + else + result += "," + optionName; + } + } + return result; + } +} diff --git a/superx/WEB-INF/conf/edustore/db/bin/qa_execute_mask.x b/superx/WEB-INF/conf/edustore/db/bin/qa_execute_mask.x deleted file mode 100755 index e5b5e87..0000000 --- a/superx/WEB-INF/conf/edustore/db/bin/qa_execute_mask.x +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash -# Zuerst SQL_ENV laden -. /home/superx/db/bin/SQL_ENV - -# Verzeichnis in dem Die Dateien abgelegt werden sollen -export FILE_DIR="$QA_PFAD" -# Dateiname -export FILE_NAME="Masken-Ausführung_Protokoll" -# Masken TID -export MASKEN_TID=37020 -# Datum für das Feld "Ab Datum" -export DATUM_EXEC=$(date "+%d.%m.%Y") -# Masken Parameter; Ausführungs-Status=1,2 (1=Warnung;2=Fehler) -export MASK_PARAM="Ausführungs-Status=1,2&Ab Datum=${DATUM_EXEC}" - -# ExecuteMask funktioniert nur im WEB-INF Ordner -cd $WEBAPP/WEB-INF - -# PDF -java -cp "$JDBC_CLASSPATH" $JAVA_OPTS de.superx.bin.ExecuteMask -tid:$MASKEN_TID -out:$FILE_DIR/$FILE_NAME.pdf -user:admin "-params:${MASK_PARAM}&stylesheet=tabelle_fo_pdf.xsl&contenttype=application/pdf" -logger:$SUPERX_DIR/db/conf/logging.properties - -# XML -#java -cp "$JDBC_CLASSPATH" $JAVA_OPTS de.superx.bin.ExecuteMask -tid:$MASKEN_TID -out:$FILE_DIR/$FILE_NAME.xml -user:admin "-params:${MASK_PARAM}&stylesheet=tabelle_fo_pdf.xsl&contenttype=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" -logger:$SUPERX_DIR/db/conf/logging.properties - -# CSV -java -cp "$JDBC_CLASSPATH" $JAVA_OPTS de.superx.bin.ExecuteMask -tid:$MASKEN_TID -out:$FILE_DIR/$FILE_NAME.csv -user:admin "-params:${MASK_PARAM}&stylesheet=tabelle_fo_pdf.xsl&contenttype=text/csv" -logger:$SUPERX_DIR/db/conf/logging.properties - -# Verzeichnis in dem die Dateien abgelegt wurden. Zum zählen und verschicken. -cd $FILE_DIR -sed -i 's/\^/ \| /g' $FILE_DIR/$FILE_NAME.csv - -#Zuerst Warnungen und Fehler zählen -export W_ANZ=$(grep -c Warnung $FILE_DIR/$FILE_NAME.csv) -export F_ANZ=$(grep -c Fehler $FILE_DIR/$FILE_NAME.csv) - -#Mail Versand -# Vor der Pipe kommt der Text, der als Nachricht verschickt werden soll -# -r ist die ausgehende Mailadresse -# -s ist Subjekt|Betreff -# -a Datei für den Anhang -# und am Ende noch Empfänger der Mail. -cat $FILE_DIR/$FILE_NAME.csv | mailx -r superx@localhost -s "Masken-Ausführung Protokoll | $W_ANZ Warnungen | $F_ANZ Fehler" -a $FILE_DIR/$FILE_NAME.pdf "${LOGMAIL}" diff --git a/superx/WEB-INF/conf/edustore/db/bin/qa_mask_execution.x b/superx/WEB-INF/conf/edustore/db/bin/qa_mask_execution.x new file mode 100755 index 0000000..03e29a5 --- /dev/null +++ b/superx/WEB-INF/conf/edustore/db/bin/qa_mask_execution.x @@ -0,0 +1,19 @@ +#!/bin/bash + +TC_UNIQUENAME=$1 +SYSTEMINFO=$2 + +ARG1="" +ARG2="" + +if [ "$TC_UNIQUENAME" != "" ] ; then + ARG1="-tc:$TC_UNIQUENAME" +fi +if [ "$SYSTEMINFO" != "" ] ; then + ARG2="-systeminfo_id:$SYSTEMINFO" +fi + +java -cp "$JDBC_CLASSPATH" $JAVA_OPTS de.superx.qa.bin.QaTestcaseExecutor -logger:$SUPERX_DIR/db/conf/logging.properties -dbproperties:$DB_PROPERTIES "$ARG1" "$ARG2" + + + diff --git a/src-modules/module/qa/etl/mask_execution/mask_execution_mail.x b/superx/WEB-INF/conf/edustore/db/bin/qa_tc_execution_mail.x similarity index 97% rename from src-modules/module/qa/etl/mask_execution/mask_execution_mail.x rename to superx/WEB-INF/conf/edustore/db/bin/qa_tc_execution_mail.x index 8c44452..6bdb0ac 100755 --- a/src-modules/module/qa/etl/mask_execution/mask_execution_mail.x +++ b/superx/WEB-INF/conf/edustore/db/bin/qa_tc_execution_mail.x @@ -1,7 +1,7 @@ #!/bin/bash # Verzeichnis in dem Die Dateien abgelegt werden sollen -FILE_DIR="$QA_PFAD/etl/mask_execution/tmp" +FILE_DIR="$QA_PFAD/tmp" mkdir -p $FILE_DIR # Dateiname diff --git a/superx/WEB-INF/lib/superx-qa.jar b/superx/WEB-INF/lib/superx-qa.jar new file mode 100644 index 0000000000000000000000000000000000000000..7ec9f0ea7dcd0c43211faf07cc2466a7621b25c2 GIT binary patch literal 8105 zcmaKx1yCJX+J*^wZ}5u*C%C)2TX1)RT?p>(8XPVb+=9EiJ0UoP;O_1a2>h9yot@eF zclUI4cXieKoKyXERiCQwQIds$eGLT#fPxyTV9bLdi?0i7?10NHRTtfr3){ zXA}T6_$xYVlrCQRD}MRw#Qb&sD=IIdAR{TEs>UcU365bw>}5s^xf6aCgGV3)#n-=E zs+b!PLBn)N_@IbfUz2a4EbiA99tdD`8)`f2XbWNe0jT(lUtQ6e5(OA!`7#z8&vj@I zzsb>snNffv&p?ep!C>1H$J`kSl1X5kO~~7%q1a-z=E$3kLm+0TikN)?lv4!pbh=cwf zcX76`{#PFG``1l$qx27oA6wIxE(m zjJx1ndGa|lFunN)9&lc|S)-pBV|yZg+k?G;!Eiqu#d3F1!#j6KFh2NutPQA9 z_B+YO0LT_pqZ-Qbb~za*sq6>Z3i?n>O)f1~G(F zbcZUW^m9-sI6Lg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