Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mv_getjoblog.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mv_createwebservice macro
4
5 <h4> SAS Macros </h4>
6 @li mp_assert.sas
7 @li mp_assertscope.sas
8 @li mv_createjob.sas
9 @li mv_jobexecute.sas
10 @li mv_jobwaitfor.sas
11 @li mv_getjoblog.sas
12
13**/
14
15/**
16 * Test Case 1
17 */
18
19/* create a service */
20filename testref temp;
21data _null_;
22 file testref;
23 put 'data;run;';
24 put 'endsas;';
25run;
26%mv_createjob(
27 path=&mcTestAppLoc/jobs/temp,
28 code=testref,
29 name=testjob
30)
31
32%* Execute it;
33%mv_jobexecute(
34 path=&mcTestAppLoc/jobs/temp,
35 name=testjob,
36 outds=work.info
37)
38
39%* Wait for it to finish;
40data work.info;
41 set work.info;
42 where method='GET' and rel='state';
43run;
44%mv_jobwaitfor(ALL,inds=work.info,outds=work.jobstates)
45
46%* and grab the uri;
47data _null_;
48 set work.jobstates;
49 call symputx('uri',uri);
50run;
51
52%* Finally, fetch the log;
53%mp_assertscope(SNAPSHOT)
54%mv_getjoblog(uri=%str(&uri),outref=mylog,mdebug=1)
55/* ignore auto proc json vars */
56%mp_assertscope(COMPARE
57 ,ignorelist=MCLIB2_JADP2LEN MCLIB2_JADPNUM MCLIB2_JADVLEN
58)
59
60data _null_;
61 infile mylog end=eof;
62 input;
63 putlog _infile_;
64 retain found 0;
65 if index(_infile_,'endsas;') then do;
66 found=1;
67 call symputx('found',found);
68 end;
69 else if eof and found ne 1 then call symputx('found',0);
70run;
71
72%mp_assert(
73 iftrue=(%str(&found)=1),
74 desc=Check if the log was still fetched even though endsas was submitted
75)