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