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