mpe_getversions.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief Testing mpe_getversions macro
4  @details Checking functionality of mpe_getversions.sas macro
5 
6  <h4> SAS Macros </h4>
7  @li mf_nobs.sas
8  @li mp_assert.sas
9  @li mp_assertscope.sas
10  @li mpe_getversions.sas
11  @li mpe_targetloader.sas
12 
13 **/
14 
15 /* run the macro*/
16 %mp_assertscope(SNAPSHOT)
17 %mpe_getversions(&mpelib,&mpelib,MPE_DATADICTIONARY, outds=ds0)
18 %mp_assertscope(COMPARE,
19  desc=Checking macro variables against previous snapshot
20 )
21 
22 
23 /* now stage some data */
24 
25 %let f1=%mf_getuniquefileref();
26 data _null_;
27  file &f1 termstr=crlf;
28  put 'ACTION:$char4. MESSAGE:$char40. LIBDS:$char38.';
29  put "LOAD,staging some data,&dclib..MPE_DATADICTIONARY";
30 run;
31 data work.jsdata;
32  set &mpelib..MPE_DATADICTIONARY;
33  _____DELETE__THIS__RECORD_____='No';
34  dd_source=cats(ranuni(0));
35  output;
36  stop;
37 run;
38 %mx_testservice(&appLoc/services/editors/stagedata,
39  viyacontext=&defaultcontext,
40  inputfiles=&f1:sascontroltable,
41  inputdatasets=jsdata,
42  outlib=web1,
43  mdebug=&sasjs_mdebug
44 )
45 
46 %let status=0;
47 data work.sasparams;
48  set web1.sasparams;
49  putlog (_all_)(=);
50  if status='SUCCESS' then call symputx('status',1);
51  call symputx('dsid',dsid);
52 run;
53 %mp_assert(
54  iftrue=(&status=1),
55  desc=Checking staged data component,
56  outds=work.test_results
57 )
58 
59 /* now approve the data so the change is applied */
60 data work.sascontroltable;
61  ACTION='APPROVE_TABLE';
62  TABLE="&dsid";
63  DIFFTIME="%sysfunc(datetime(),datetime19.)";
64  output;
65  stop;
66 run;
67 %mx_testservice(&appLoc/services/auditors/postdata,
68  viyacontext=&defaultcontext,
69  inputdatasets=work.sascontroltable,
70  outlib=web2,
71  outref=wbout,
72  mdebug=&sasjs_mdebug
73 )
74 
75 
76 /* finally - check that we have an extra version! */
77 
78 %mpe_getversions(&mpelib,&mpelib,MPE_DATADICTIONARY, outds=ds1)
79 
80 %mp_assert(
81  iftrue=(%mf_nobs(ds0) = %mf_nobs(ds1)-1),
82  desc=Checking one extra version was created
83 )
84