validatefilter.test.sas
Go to the documentation of this file.
1 /**
2  @file
3  @brief testing public/validatefilter service
4 
5  <h4> SAS Macros </h4>
6  @li mp_assertdsobs.sas
7  @li mp_assertcolvals.sas
8  @li mf_getuniquefileref.sas
9 
10 **/
11 
12 %let _program=&appLoc/services/public/validatefilter;
13 
14 /* filter for one record */
15 %let f1=%mf_getuniquefileref();
16 data _null_;
17  file &f1 termstr=crlf;
18  put 'filter_table:$41.';
19  put "&dclib..MPE_TABLES";
20 run;
21 %let f2=%mf_getuniquefileref();
22 data _null_;
23  file &f2 termstr=crlf;
24  infile datalines4 dsd;
25  input;
26  put _infile_;
27 datalines4;
28 GROUP_LOGIC:$3. SUBGROUP_LOGIC:$3. SUBGROUP_ID:8. VARIABLE_NM:$32. OPERATOR_NM:$10. RAW_VALUE:$4000.
29 AND,AND,1,LIBREF,CONTAINS,"'DC'"
30 AND,OR,2,DSN,=,"'MPE_LOCK_ANYTABLE'"
31 ;;;;
32 run;
33 %mp_testservice(&_program,
34  viyacontext=&defaultcontext,
35  inputfiles=&f1:iwant &f2:filterquery,
36  outlib=web1
37 )
38 data result;
39  set web1.result;
40 run;
41 %mp_assertdsobs(work.result,
42  desc=Test1 result filter,
43  test=EQUALS 1
44 )
45 
46 /* filter for one record */
47 
48 data work.iwant;
49  filter_table='DCTEST.DCFMTS-FC';
50 run;
51 data work.filterquery;
52 GROUP_LOGIC='AND';
53 SUBGROUP_LOGIC='AND';
54 SUBGROUP_ID=1;
55 VARIABLE_NM='FMTNAME';
56 OPERATOR_NM='CONTAINS';
57 RAW_VALUE="'MORD'";
58 ;;;;
59 run;
60 %mp_testservice(&_program,
61  viyacontext=&defaultcontext,
62  inputdatasets=work.iwant work.filterquery,
63  outlib=web2,
64  outref=web2ref
65 )
66 data _null_;
67  infile web2ref;
68  input;
69  putlog _infile_;
70 run;
71 data result;
72  set web2.result;
73  putlog (_all_)(=);
74 run;
75 %mp_assertdsobs(work.result,
76  desc=Test2 result filter,
77  test=EQUALS 1
78 )