diff --git a/.gitignore b/.gitignore index 862fe0a..9411085 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,7 @@ sasjsbuild/ **\ ** # ignore the mc_* files - containing macros for individual libraries -mc_* \ No newline at end of file +mc_* + +# ignore .env files as they can contain sasjs access tokens +*.env* \ No newline at end of file diff --git a/sasjs/sasjsconfig.json b/sasjs/sasjsconfig.json index cea7e36..192034e 100644 --- a/sasjs/sasjsconfig.json +++ b/sasjs/sasjsconfig.json @@ -1,7 +1,7 @@ { "$schema": "https://cli.sasjs.io/sasjsconfig-schema.json", "macroFolders": ["base", "meta", "metax", "viya", "lua"], - "docConfig":{ + "docConfig": { "displayMacroCore": false, "enableLineage": false, "doxyContent": { @@ -9,5 +9,26 @@ "logo": "Macro_core_website_1.png", "readMe": "../../README.md" } - } + }, + "serviceConfig": { + "initProgram": "tests/testinit.sas" + }, + "defaultTarget": "viya", + "targets": [ + { + "name": "viya", + "serverUrl": "https://sas.analytium.co.uk", + "serverType": "SASVIYA", + "appLoc": "/Public/temp/macrocore", + "serviceConfig": { + "serviceFolders": ["tests/viya"], + "macroVars": { + "mcTestAppLoc": "/Public/temp/macrocore" + } + }, + "deployConfig": { + "deployServicePack": true + } + } + ] } diff --git a/tests/testinit.sas b/tests/testinit.sas new file mode 100644 index 0000000..4daa961 --- /dev/null +++ b/tests/testinit.sas @@ -0,0 +1,8 @@ +/** + @file + @brief init file for tests + +**/ + +/* location in metadata or SAS Drive for temporary files */ +%let mcTestAppLoc=/Public/temp/test; \ No newline at end of file diff --git a/tests/viya/mv_createwebservice.test.sas b/tests/viya/mv_createwebservice.test.sas new file mode 100644 index 0000000..4abee82 --- /dev/null +++ b/tests/viya/mv_createwebservice.test.sas @@ -0,0 +1,24 @@ +/** + @file + @brief Testing mv_createwebservice macro + +

SAS Macros

+ @li mv_createwebservice.sas + +**/ + +/** + * Test Case 1 + * Send special char in a service + */ + +filename testref temp; +data _null_; + file testref; + put '01'x; +run; +%mv_createwebservice( + path=&mcTestAppLoc/tests/macros, + code=testref, + name=mv_createwebservice +) \ No newline at end of file diff --git a/viya/mv_createwebservice.sas b/viya/mv_createwebservice.sas index 704e30c..770dec4 100644 --- a/viya/mv_createwebservice.sas +++ b/viya/mv_createwebservice.sas @@ -46,9 +46,10 @@ needs to be attached to the beginning of the service @param code= Fileref(s) of the actual code to be added @param access_token_var= The global macro variable to contain the access token - @param grant_type= valid values are "password" or "authorization_code" (unquoted). - The default is authorization_code. - @param replace= select NO to avoid replacing any existing service in that location + @param grant_type= valid values are "password" or "authorization_code" + (unquoted). The default is authorization_code. + @param replace= select NO to avoid replacing any existing service in that + location @param adapter= the macro uses the sasjs adapter by default. To use another adapter, add a (different) fileref here. @param contextname= Choose a specific context on which to run the Job. Leave @@ -145,7 +146,8 @@ libname &libref1 JSON fileref=&fname1; data _null_; set &libref1..links; - if rel='members' then call symputx('membercheck',quote("&base_uri"!!trim(href)),'l'); + if rel='members' then + call symputx('membercheck',quote("&base_uri"!!trim(href)),'l'); else if rel='self' then call symputx('parentFolderUri',href,'l'); run; data _null_; @@ -592,6 +594,14 @@ run; rc =fput(fileid,'\');rc =fwrite(fileid); rc =fput(fileid,'\');rc =fwrite(fileid); end; + else if rec='01'x then do; /* Unprintable */ + rc =fput(fileid,'\');rc =fwrite(fileid); + rc =fput(fileid,'u');rc =fwrite(fileid); + rc =fput(fileid,'0');rc =fwrite(fileid); + rc =fput(fileid,'0');rc =fwrite(fileid); + rc =fput(fileid,'0');rc =fwrite(fileid); + rc =fput(fileid,'1');rc =fwrite(fileid); + end; else do; rc =fput(fileid,rec); rc =fwrite(fileid);