Macros for SAS Application Developers
https://github.com/sasjs/core
mv_getjobresult.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_assertdsobs.sas
7  @li mv_createwebservice.sas
8  @li mv_getjobresult.sas
9  @li mv_jobflow.sas
10 
11 **/
12 
13 options mprint notes;
14 
15 /**
16  * Test Case 1
17  */
18 
19 /* create a service */
20 filename testref temp;
21 data _null_;
22  file testref;
23  put 'data test; set sashelp.class;run;';
24  put '%webout(OPEN)';
25  put '%webout(OBJ,test)';
26  put '%webout(CLOSE)';
27 run;
28 %mv_createwebservice(
29  path=&mcTestAppLoc/services/temp,
30  code=testref,
31  name=testsvc
32 )
33 
34 /* trigger and wait for it to finish */
35 data work.inputjobs;
36  _program="&mcTestAppLoc/services/temp/testsvc";
37 run;
38 %mv_jobflow(inds=work.inputjobs
39  ,maxconcurrency=4
40  ,outds=work.results
41  ,outref=myjoblog
42 )
43 /* stream the log */
44 data _null_;
45  infile myjoblog;
46  input;
47  put _infile_;
48 run;
49 
50 /* fetch the uri */
51 data _null_;
52  set work.results;
53  call symputx('uri',uri);
54  put (_all_)(=);
55 run;
56 
57 /* now get the results */
58 %mv_getjobresult(uri=&uri
59  ,result=WEBOUT_JSON
60  ,outref=myweb
61  ,outlib=myweblib
62 )
63 data _null_;
64  infile myweb;
65  input;
66  putlog _infile_;
67 run;
68 data work.out;
69  set myweblib.test;
70  put (_all_)(=);
71 run;
72 %mp_assertdsobs(work.out,
73  desc=Test1 - 19 obs from sashelp.class in service result,
74  test=EQUALS 19,
75  outds=work.test_results
76 )