From 458c27418681d1c1eddf54968cfc5c9715f59943 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Fri, 3 Apr 2020 16:16:45 +0200 Subject: [PATCH] Adding StorageHub rules --- .../datamodel/validations/validators/TestRules.java | 2 +- .../rules/StorageHub/StorageHub-downloadById.csv | 6 ++++++ .../rules/StorageHub/StorageHub-downloadById.json | 12 ++++++++++++ .../rules/StorageHub/StorageHub-getById.json | 2 +- .../rules/StorageHub/StorageHub-getGroups.csv | 2 ++ .../rules/StorageHub/StorageHub-getGroups.json | 12 ++++++++++++ .../rules/StorageHub/StorageHub-getHistory.csv | 1 + .../rules/StorageHub/StorageHub-getHistory.json | 12 ++++++++++++ 8 files changed, 47 insertions(+), 2 deletions(-) create mode 100644 src/test/resources/rules/StorageHub/StorageHub-downloadById.csv create mode 100644 src/test/resources/rules/StorageHub/StorageHub-downloadById.json create mode 100644 src/test/resources/rules/StorageHub/StorageHub-getGroups.csv create mode 100644 src/test/resources/rules/StorageHub/StorageHub-getGroups.json create mode 100644 src/test/resources/rules/StorageHub/StorageHub-getHistory.csv create mode 100644 src/test/resources/rules/StorageHub/StorageHub-getHistory.json diff --git a/src/test/java/org/gcube/accounting/datamodel/validations/validators/TestRules.java b/src/test/java/org/gcube/accounting/datamodel/validations/validators/TestRules.java index e9a4300..bb1af8b 100644 --- a/src/test/java/org/gcube/accounting/datamodel/validations/validators/TestRules.java +++ b/src/test/java/org/gcube/accounting/datamodel/validations/validators/TestRules.java @@ -220,7 +220,7 @@ public class TestRules extends ContextTest { allRules(); File rulesDirectory = getRulesDirectory(); File rulesDirFile = new File(rulesDirectory, "StorageHub"); - File ruleFile = new File(rulesDirFile, "StorageHub-getById.json"); + File ruleFile = new File(rulesDirFile, "StorageHub-getHistory.json"); testRule(ruleFile); } diff --git a/src/test/resources/rules/StorageHub/StorageHub-downloadById.csv b/src/test/resources/rules/StorageHub/StorageHub-downloadById.csv new file mode 100644 index 0000000..4937de4 --- /dev/null +++ b/src/test/resources/rules/StorageHub/StorageHub-downloadById.csv @@ -0,0 +1,6 @@ +DataAccess,StorageHub,/workspace/item/21449ee9-de89-41a7-b60e-c0e15975bbf5/download +DataAccess,StorageHub,/workspace/item/2ca7e04a-b461-4098-a8b9-a31ddb691a2d/download +DataAccess,StorageHub,/workspace/item/9666bbf1-3b06-487b-adaf-29e175b7fbc1/download +DataAccess,StorageHub,/workspace/item/ace9ea0c-2877-4659-bca8-9519fc9cef83/download +DataAccess,StorageHub,/workspace/item/be512d5c-6038-440c-bb05-914ce3f44f50/download +DataAccess,StorageHub,downloadById \ No newline at end of file diff --git a/src/test/resources/rules/StorageHub/StorageHub-downloadById.json b/src/test/resources/rules/StorageHub/StorageHub-downloadById.json new file mode 100644 index 0000000..2f35888 --- /dev/null +++ b/src/test/resources/rules/StorageHub/StorageHub-downloadById.json @@ -0,0 +1,12 @@ +{ + "match": { + "serviceClassRegex": "DataAccess", + "serviceNameRegex": "StorageHub", + "calledMethodRegex": "^\/workspace\/item(s){0,1}\/[0-9a-zA-Z\\-_]*\/download(\/){0,1}$|downloadById" + }, + "replace": { + "serviceClass": "DataAccess", + "serviceName": "StorageHub", + "calledMethod": "downloadById" + } +} \ No newline at end of file diff --git a/src/test/resources/rules/StorageHub/StorageHub-getById.json b/src/test/resources/rules/StorageHub/StorageHub-getById.json index 1a454ff..ef56e84 100644 --- a/src/test/resources/rules/StorageHub/StorageHub-getById.json +++ b/src/test/resources/rules/StorageHub/StorageHub-getById.json @@ -2,7 +2,7 @@ "match": { "serviceClassRegex": "DataAccess", "serviceNameRegex": "StorageHub", - "calledMethodRegex": "^\/workspace(\/item(s){0,1}){0,1}\/(?!(i$)|count|paged|v(re|ere|er)fo(ld|dl)ers{0,1}|((C|c)hi(dl|ld|d)ren))[0-9a-zA-Z\\-_]{1,}(\/){0,1}$|getById" + "calledMethodRegex": "^\/workspace(\/item(s){0,1}){0,1}\/(?!(i$)|count|groups|paged|v(re|ere|er)fo(ld|dl)ers{0,1}|((C|c)hi(dl|ld|d)ren))[0-9a-zA-Z\\-_]{1,}(\/){0,1}$|getById" }, "replace": { "serviceClass": "DataAccess", diff --git a/src/test/resources/rules/StorageHub/StorageHub-getGroups.csv b/src/test/resources/rules/StorageHub/StorageHub-getGroups.csv new file mode 100644 index 0000000..43745e2 --- /dev/null +++ b/src/test/resources/rules/StorageHub/StorageHub-getGroups.csv @@ -0,0 +1,2 @@ +DataAccess,StorageHub,/workspace/groups +DataAccess,StorageHub,/workspace/groups/gcube-preprod-preVRE/createVREFolder diff --git a/src/test/resources/rules/StorageHub/StorageHub-getGroups.json b/src/test/resources/rules/StorageHub/StorageHub-getGroups.json new file mode 100644 index 0000000..75b3117 --- /dev/null +++ b/src/test/resources/rules/StorageHub/StorageHub-getGroups.json @@ -0,0 +1,12 @@ +{ + "match": { + "serviceClassRegex": "DataAccess", + "serviceNameRegex": "StorageHub", + "calledMethodRegex": "^\/workspace\/group(s){0,1}\/{0,1}.*" + }, + "replace": { + "serviceClass": "DataAccess", + "serviceName": "StorageHub", + "calledMethod": "getGroups" + } +} \ No newline at end of file diff --git a/src/test/resources/rules/StorageHub/StorageHub-getHistory.csv b/src/test/resources/rules/StorageHub/StorageHub-getHistory.csv new file mode 100644 index 0000000..db6423e --- /dev/null +++ b/src/test/resources/rules/StorageHub/StorageHub-getHistory.csv @@ -0,0 +1 @@ +DataAccess,StorageHub,/workspace/items/21449ee9-de89-41a7-b60e-c0e15975bbf5/history \ No newline at end of file diff --git a/src/test/resources/rules/StorageHub/StorageHub-getHistory.json b/src/test/resources/rules/StorageHub/StorageHub-getHistory.json new file mode 100644 index 0000000..009b85b --- /dev/null +++ b/src/test/resources/rules/StorageHub/StorageHub-getHistory.json @@ -0,0 +1,12 @@ +{ + "match": { + "serviceClassRegex": "DataAccess", + "serviceNameRegex": "StorageHub", + "calledMethodRegex": "^\/workspace\/item(s){0,1}\/[0-9a-zA-Z\\-_]*\/history(\/){0,1}$|getHistory" + }, + "replace": { + "serviceClass": "DataAccess", + "serviceName": "StorageHub", + "calledMethod": "getHistory" + } +} \ No newline at end of file