Loading...
Searching...
No Matches
getchangeinfo.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief testing getchangeinfo service
4
5 <h4> SAS Macros </h4>
6 @li mp_assert.sas
7 @li mp_assertcolvals.sas
8 @li mf_getuniquefileref.sas
9
10**/
11
12%let _program=&appLoc/services/public/getchangeinfo;
13
14/**
15 * First part - stage some data (for diffing)
16 */
17data work.sascontroltable;
18 action='LOAD';
19 message="getdiffs prep";
20 libds="&dclib..MPE_X_TEST";
21 output;
22 stop;
23run;
24proc sql noprint;
25select max(primary_key_field) into: maxpk from &dclib..mpe_x_test;
26data work.jsdata;
27 set &dclib..mpe_x_test(rename=(
28 some_date=dt2 SOME_DATETIME=dttm2 SOME_TIME=tm2)
29 );
30 /* for now, the adapter sends these as strings */
31 some_date=put(dt2,date9.);
32 SOME_DATETIME=put(dttm2,datetime19.);
33 some_time=put(tm2,time.);
34 drop dt2 dttm2 tm2;
35 _____DELETE__THIS__RECORD_____='No';
36 if _n_=1 then do;
37 primary_key_field=sum(&maxpk,1);
38 some_char=' leadingblanks';
39 some_num=._;
40 output;
41 end;
42 else if _n_<3 then do;
43 SOME_NUM=ranuni(0);
44 end;
45 else stop;
46run;
47
48%mx_testservice(&appLoc/services/editors/stagedata,
49 viyacontext=&defaultcontext,
50 inputdatasets=work.jsdata work.sascontroltable,
51 outlib=web1,
52 mdebug=&sasjs_mdebug
53)
54
55%let status=0;
56data work.sasparams;
57 set web1.sasparams;
58 putlog (_all_)(=);
59 if status='SUCCESS' then call symputx('status',1);
60 call symputx('dsid',dsid);
61run;
62%mp_assert(
63 iftrue=(&status=1 and &syscc=0),
64 desc=Checking successful submission
65)
66
67
68/* now call getchangeinfo */
69%let f3=%mf_getuniquefileref();
70data _null_;
71 file &f3 termstr=crlf;
72 put 'TABLE:$43.';
73 put "&dsid";
74run;
75%mp_testservice(&_program,
76 viyacontext=&defaultcontext,
77 inputfiles=&f3:sascontroltable,
78 outlib=web3,
79 mdebug=&sasjs_mdebug
80)
81
82data work.jsparams;
83 set web3.jsparams;
84 putlog (_all_)(=);
85 call symputx('ALLOW_RESTORE',ALLOW_RESTORE);
86run;
87%mp_assert(
88 iftrue=(&syscc=0),
89 desc=Checking successful execution
90)
91%mp_assert(
92 iftrue=(%mf_nobs(work.jsparams)=1),
93 desc=Checking data was returned
94)
95%mp_assert(
96 iftrue=(&ALLOW_RESTORE=NO),
97 desc=Checking admin user cannot restore - as table was not approved
98)