getddl.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief testing getddl service
4 
5  <h4> SAS Macros </h4>
6  @li mp_assertdsobs.sas
7  @li mx_testservice.sas
8 
9 **/
10 
11 
12 %let _program=&appLoc/services/public/getddl;
13 
14 /* test 1 */
15 data work.params;
16  length name $32 value $1000;
17  name='libref';value="&dclib";output;
18  name='ds';value='';output;
19  name='flavour';value='TSQL';output;
20 run;
21 %mx_testservice(&_program,
22  viyacontext=&defaultcontext,
23  inputparams=work.params,
24  outref=webout,
25  viyaresult=WEBOUT_TXT,
26  mdebug=&sasjs_mdebug
27 )
28 
29 data work.results;
30  infile webout;
31  input;
32  putlog _infile_;
33  if _n_=2 then do;
34  if _infile_=:'/* TSQL Flavour DDL for' then do;
35  putlog 'test passed';
36  output;
37  output;
38  end;
39  stop;
40  end;
41  else if _n_>2 then stop;
42 run;
43 
44 %mp_assertdsobs(work.results,
45  desc=DDL file is successfully returned,
46  test=EQUALS 2,
47  outds=work.test_results
48 )
49 
50 /* test 2 - format catalog */
51 data work.params;
52  length name $32 value $1000;
53  name='libref';value="DCTEST";output;
54  name='ds';value='DCFMTS-FC';output;
55 run;
56 %mx_testservice(&_program,
57  viyacontext=&defaultcontext,
58  inputparams=work.params,
59  outref=web2,
60  viyaresult=WEBOUT_TXT,
61  mdebug=&sasjs_mdebug
62 )
63 
64 data work.results2;
65  infile web2;
66  input;
67  putlog _infile_;
68  if index(upcase(_infile_),'WORK.FMTEXTRACT') then do;
69  putlog 'test passed';
70  output;
71  output;
72  stop;
73  end;
74  else if _n_>50 then stop;
75 run;
76 
77 %mp_assertdsobs(work.results2,
78  desc=DDL file is successfully returned from format catalog,
79  test=EQUALS 2,
80  outds=work.test_results
81 )