1
0
mirror of https://github.com/sasjs/core.git synced 2025-12-10 22:14:35 +00:00

fix: updating mv_createwebservice to support 0x01 hex characters, adding a test (and test scaffolding) as part of this. The test scaffolding will be updated once goes live - for now it is being deployed as a service.

This commit is contained in:
2021-04-17 00:11:06 +02:00
parent d6056b9397
commit ba1272aaf7
5 changed files with 73 additions and 7 deletions

5
.gitignore vendored
View File

@@ -6,4 +6,7 @@ sasjsbuild/
**\ **
# ignore the mc_* files - containing macros for individual libraries
mc_*
mc_*
# ignore .env files as they can contain sasjs access tokens
*.env*

View File

@@ -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
}
}
]
}

8
tests/testinit.sas Normal file
View File

@@ -0,0 +1,8 @@
/**
@file
@brief init file for tests
**/
/* location in metadata or SAS Drive for temporary files */
%let mcTestAppLoc=/Public/temp/test;

View File

@@ -0,0 +1,24 @@
/**
@file
@brief Testing mv_createwebservice macro
<h4> SAS Macros </h4>
@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
)

View File

@@ -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);