1
0
mirror of https://github.com/sasjs/core.git synced 2026-01-05 00:20:05 +00:00

feat: new mv_getjobresult.sas macro, corresponding test, and additional fixes

This commit is contained in:
Allan Bowe
2021-05-06 01:07:25 +03:00
parent b1380983ec
commit 04a3189a89
8 changed files with 489 additions and 14 deletions

View File

@@ -5,4 +5,4 @@
**/
/* location in metadata or SAS Drive for temporary files */
%let mcTestAppLoc=/Public/temp/test;
%let mcTestAppLoc=/Public/temp/macrocore;

View File

@@ -19,23 +19,27 @@ data _null_;
put '01'x;
run;
%mv_createwebservice(
path=&mcTestAppLoc/tests/macros,
path=&mcTestAppLoc/temp/macros,
code=testref,
name=mv_createwebservice
)
filename compare temp;
%mv_getjobcode(
path=&mcTestAppLoc/tests/macros
path=&mcTestAppLoc/temp/macros
,name=mv_createwebservice
,outref=compare;
)
data test_results;
length test_description $256 test_result $4 test_comments $256;
infile compare;
infile compare end=eof;
input;
if _infile_='01'x then test_result='PASS';
else test_result='FAIL';
test_description="Creating web service with invisible character";
if eof then do;
if _infile_='01'x then test_result='PASS';
else test_result='FAIL';
test_description="Creating web service with invisible character";
output;
stop;
end;
run;

View File

@@ -0,0 +1,74 @@
/**
@file
@brief Testing mv_createwebservice macro
<h4> SAS Macros </h4>
@li mp_assertdsobs.sas
@li mv_createwebservice.sas
@li mv_getjobresult.sas
@li mv_jobflow.sas
**/
/**
* Test Case 1
*/
/* create a service */
filename testref temp;
data _null_;
file testref;
put 'data test; set sashelp.class;run;';
put '%webout(OPEN)';
put '%webout(OBJ,test)';
put '%webout(CLOSE)';
run;
%mv_createwebservice(
path=&mcTestAppLoc/services/temp,
code=testref,
name=testsvc
)
/* trigger and wait for it to finish */
data work.inputjobs;
_program="&mcTestAppLoc/services/temp/testsvc";
run;
%mv_jobflow(inds=work.inputjobs
,maxconcurrency=4
,outds=work.results
,outref=myjoblog
)
/* stream the log */
data _null_;
infile myjoblog;
input;
put _infile_;
run;
/* fetch the uri */
data _null_;
set work.results;
call symputx('uri',uri);
put (_all_)(=);
run;
/* now get the results */
%mv_getjobresult(uri=&uri
,result=WEBOUT_JSON
,outref=myweb
,outlib=myweblib
)
data _null_;
infile myweb;
input;
putlog _infile_;
run;
data work.out;
set myweblib.test;
put (_all_)(=);
run;
%mp_assertdsobs(work.out,
desc=Test1 - 19 obs from sashelp.class in service result,
test=EQUALS 19,
outds=work.test_results
)