Loading...
Searching...
No Matches
restore.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief testing restore process
4
5 <h4> SAS Macros </h4>
6 @li mf_getuniquefileref.sas
7 @li mx_testservice.sas
8 @li mp_assert.sas
9
10
11**/
12
13%let _program=&appLoc/services/editors/restore;
14
15/* take a snapshot of the table for later comparison */
16proc sort data=&mpelib..mpe_x_test out=work.origds;
17by primary_key_field;
18run;
19
20/* run an update */
21%mx_testservice(&appLoc/tests/services/auditors/postdata.test.1,
22 viyacontext=&defaultcontext
23)
24
25/* grab the loadref for later reversion */
26%let loadref=0;
27data APPROVE1;
28 set &mpelib..mpe_submit end=last;
29 if last then call symputx('loadref',table_id);
30run;
31
32/* run another update for good measure */
33%mx_testservice(&appLoc/tests/services/auditors/postdata.test.1,
34 viyacontext=&defaultcontext
35)
36
37/* now we are ready to revert */
38data work.restore_in;
39 load_ref="&loadref";
40 output;
41 stop;
42run;
43%mx_testservice(&_program,
44 viyacontext=&defaultcontext,
45 inputdatasets=work.restore_in,
46 outlib=web1,
47 mdebug=&sasjs_mdebug
48)
49
50/* check for success */
51%let loadref=0;
52data work.restore_out;
53 set web1.restore_out;
54 putlog (_all_)(=);
55 call symputx('newref',loadref);
56run;
57%mp_assert(
58 iftrue=(&newref ne 0),
59 desc=Checking successful submission of a reversion,
60 outds=work.test_results
61)
62
63/* approve the reversion */
64data work.sascontroltable;
65 ACTION='APPROVE_TABLE';
66 TABLE="&newref";
67 /* difftime is numeric for approve action */
68 DIFFTIME="%sysfunc(datetime())";
69 output;
70 stop;
71run;
72%mx_testservice(&appLoc/services/auditors/postdata,
73 viyacontext=&defaultcontext,
74 inputdatasets=work.sascontroltable,
75 outlib=web3,
76 outref=wb3,
77 mdebug=&sasjs_mdebug
78)
79
80%let status=0;
81data _null_;
82 set web3.apparams;
83 putlog (_all_)(=);
84 if response='SUCCESS!' then call symputx('status',1);
85run;
86
87%mp_assert(
88 iftrue=(&status=1 and &syscc=0),
89 desc=Checking successful submission of reversion
90)
91
92/* compare snapshot with latest data */
93proc sort data=&mpelib..mpe_x_test out=work.compareds;
94by primary_key_field;
95run;
96
97proc compare base=work.origds compare=work.compareds
98 out=work.resultds outnoequal;
99run;
100data _null_;
101 set work.resultds;
102 if &sasjs_mdebug=1 then putlog (_all_)(=);
103 if _n_>10 then stop;
104run;
105%mp_assert(
106 iftrue=(&sysinfo le 41),
107 desc=Checking compare of MPE_X_TEST,
108 outds=work.test_results
109)