Adding and fixing rules
This commit is contained in:
parent
fbbfa34702
commit
f657e1c4b4
|
@ -219,11 +219,33 @@ public class TestRules extends ContextTest {
|
|||
public void testSingleRule() throws Exception {
|
||||
allRules();
|
||||
File rulesDirectory = getRulesDirectory();
|
||||
File rulesDirFile = new File(rulesDirectory, "DataMiner");
|
||||
File rulesFile = new File(rulesDirFile, "DataMiner-all.json");
|
||||
testRule(rulesFile);
|
||||
File rulesDirFile = new File(rulesDirectory, "Catalogue-WS");
|
||||
File ruleFile = new File(rulesDirFile, "Catalogue-WS-collection.json");
|
||||
testRule(ruleFile);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllRuleInAdirectory() throws Exception {
|
||||
allRules();
|
||||
File rulesDirectory = getRulesDirectory();
|
||||
File rulesDirFile = new File(rulesDirectory, "gcat");
|
||||
|
||||
FilenameFilter filenameFilter = new FilenameFilter() {
|
||||
@Override
|
||||
public boolean accept(File dir, String name) {
|
||||
return name.endsWith(".json");
|
||||
}
|
||||
};
|
||||
|
||||
List<File> rulesFiles = new ArrayList<>();
|
||||
rulesFiles.addAll(Arrays.asList(rulesDirFile.listFiles(filenameFilter)));
|
||||
|
||||
for(File ruleFile : rulesFiles) {
|
||||
testRule(ruleFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testAllRules() throws Exception {
|
||||
List<File> rulesFiles = allRules();
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/groups/create
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/groups/show
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/create
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/delete
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/purge
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/show
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/resources/create
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/resources/delete
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/resources/show
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/namespaces/show
|
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})group(s){0,1}\/(?<Action>(create|show|purge|delete))(\/{0,1})"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})(?<Collection>(group|item|resource|namespace))(s){0,1}\/(?<Action>(create|show|purge|delete))(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Group"
|
||||
"calledMethod": "${Action} ${Collection}"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/groups/list
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/list
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/resources/list
|
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})item(s){0,1}\/(?<Action>(create|show|purge|delete))(\/{0,1})"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})(?<Collection>(groups|items|resources))\/(?<Action>list)(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Item"
|
||||
"calledMethod": "${Action} ${Collection}"
|
||||
}
|
||||
}
|
|
@ -1,2 +0,0 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/groups/create
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/groups/show
|
|
|
@ -1 +0,0 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/groups/list
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})group(s){0,1}\/(?<Action>list)(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Groups"
|
||||
}
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/items/create
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/delete
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/purge
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/items/show
|
|
|
@ -1 +0,0 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/items/list
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})item(s){0,1}\/(?<Action>list)(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Items"
|
||||
}
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "^\/rest\/(api\/){0,1}licen(c|s)es\/(?<Action>(create|show|purge|delete))(\/{0,1})"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})licen(c|s)es\/(?<Action>(create|show|purge|delete))(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}License"
|
||||
"calledMethod": "${Action} license"
|
||||
}
|
||||
}
|
|
@ -4,12 +4,3 @@ Data-Catalogue,Catalogue-WS,/rest/api/licences/list
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/licenses/list/
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/licences/list
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/licenses/list/
|
||||
|
||||
Data-Catalogue Catalogue-WS /rest/api/licenses/show
|
||||
|
||||
|
||||
|
||||
Data-Catalogue Catalogue-WS /rest/api/namespaces/show
|
||||
Data-Catalogue Catalogue-WS /rest/api/profiles/namespaces
|
||||
Data-Catalogue Catalogue-WS /rest/api/profiles/profile
|
||||
Data-Catalogue Catalogue-WS /rest/api/profiles/profile_names
|
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "^\/rest\/(api\/){0,1}licen(c|s)es\/(?<Action>list)(\/{0,1})"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})licen(c|s)es\/(?<Action>list)(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Licenses"
|
||||
"calledMethod": "${Action} licenses"
|
||||
}
|
||||
}
|
|
@ -1,2 +1 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/namespaces/show
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/profiles/namespaces
|
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})(profiles){0,1}namespaces(s){0,1}.*"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})profiles\/namespaces(s){0,1}.*"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Resource"
|
||||
"calledMethod": "list namespaces"
|
||||
}
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "\/rest\/(api\/){0,1}organi(s|z)ation(s){0,1}\/(?<Action>(create|show|purge|delete))(\/{0,1})"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})organi(s|z)ation(s){0,1}\/(?<Action>(create|show|purge|delete))(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Organization"
|
||||
"calledMethod": "${Action} organization"
|
||||
}
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1}organi(s|z)ation(s){0,1}\/(?<Action>list)\/{0,1}.*)|(listOrgani(s|z)ation(s{0,1}))"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})organi(s|z)ation(s){0,1}\/(?<Action>list)(\/){0,1}.*|(listOrgani(s|z)ation(s{0,1}))"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "listOrganizations"
|
||||
"calledMethod": "list organizations"
|
||||
}
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})profile(s){0,1}\/(?<Action>(show|profile))(\/{0,1})"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})profile(s){0,1}\/(?<Action>(show|profile))(\/){0,1}"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "showProfile"
|
||||
"calledMethod": "show profile"
|
||||
}
|
||||
}
|
|
@ -2,11 +2,11 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})profile(s){0,1}\/(?<Action>(list|profile_names))(\/{0,1})"
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1})profile(s){0,1}\/(?<Action>(list|profile_names))(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "listProfile"
|
||||
"calledMethod": "list profile"
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/resources/create
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/resources/delete
|
||||
Data-Catalogue,Catalogue-WS,/rest/api/resources/show
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})resource(s){0,1}\/(?<Action>create|show|purge|delete)(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Resource"
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
Data-Catalogue,Catalogue-WS,/rest/api/resources/list
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "Catalogue-WS",
|
||||
"calledMethodRegex": "(\/rest\/(api\/){0,1})resource(s){0,1}\/(?<Action>list)(\/{0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "Catalogue-WS",
|
||||
"calledMethod": "${Action}Resource"
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "Portal",
|
||||
"serviceNameRegex": "SocialNetworking",
|
||||
"calledMethodRegex": "(\/{0,1}(rest))|OTHER"
|
||||
"calledMethodRegex": "(\/{0,1}(rest))|OTHER|UNKNOWN"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "Portal",
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"match": {
|
||||
"serviceClassRegex": "Portal",
|
||||
"serviceNameRegex": "SocialNetworking",
|
||||
"calledMethodRegex": "\/{0,1}rest\/((1|2)\/){0,1}(((users(\/2){0,1})|comments|full-text-search|hashtags|messages|notifications|people|posts|tokens|vres|vers)\/){0,1}(?<Method>[a-zA-Z\\-]*)"
|
||||
"calledMethodRegex": "\/{0,1}rest\/((1|2)\/){0,1}(((users(\/2){0,1})|comments|full-text-search|hashtags|messages|notifications|people|posts|tokens|vres|vers)\/){0,1}(?<Method>[a-zA-Z\\-]*(\/){0,1})"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "Portal",
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
DataTransfer,data-transfer-service,OTHER
|
|
|
@ -0,0 +1,3 @@
|
|||
DataCatalogue,science-catalogue,/index
|
||||
DataCatalogue,science-catalogue,OTHER
|
||||
DataCatalogue,science-catalogue,UNKNOWN
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(DataCatalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "(science-catalogue)|(gcat)|(gCat)",
|
||||
"calledMethodRegex": "(\/index)|OTHER|UNKNOWN"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "gcat",
|
||||
"calledMethod": "OTHER"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
DataCatalogue,science-catalogue,/groups/ABCD
|
||||
DataCatalogue,science-catalogue,/groups/aaaaaa
|
||||
DataCatalogue,science-catalogue,/groups/fd72502e-ddfa-4121-a12a-bb42e572d649
|
||||
DataCatalogue,science-catalogue,/items/14f76289_43fa_4a76_8f36_a48793b9dd82
|
||||
DataCatalogue,science-catalogue,/items/ABCD
|
||||
DataCatalogue,science-catalogue,/items/f13813ae-7205-434d-8baf-3661ab665127
|
||||
DataCatalogue,science-catalogue,/items/restful_transaction_model
|
||||
DataCatalogue,science-catalogue,/organizations/algorithms
|
||||
DataCatalogue,science-catalogue,/organizations/aquamaps1
|
||||
DataCatalogue,science-catalogue,/profiles/Empty%20Profile
|
||||
DataCatalogue,science-catalogue,/rest/api/items/create
|
||||
DataCatalogue,science-catalogue,/users/andrearossi
|
||||
DataCatalogue,science-catalogue,/users/luca_frosini
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(DataCatalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "(science-catalogue)|(gcat)|(gCat)",
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1}){0,1}(?<Collection>group|item|license|namespace|organization|profile|user)s\/(?!list)[%0-9a-zA-Z\\-_]*$"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "gcat",
|
||||
"calledMethod": "read ${Collection}"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
DataCatalogue,science-catalogue,/groups
|
||||
DataCatalogue,science-catalogue,/items
|
||||
DataCatalogue,science-catalogue,/licenses
|
||||
DataCatalogue,science-catalogue,/namespaces
|
||||
DataCatalogue,science-catalogue,/organizations
|
||||
DataCatalogue,science-catalogue,/profiles
|
||||
DataCatalogue,science-catalogue,/users
|
||||
DataCatalogue,science-catalogue,/rest/api/groups/list
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(DataCatalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "(science-catalogue)|(gcat)|(gCat)",
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1}){0,1}(?<Collection>((groups(\/list){0,1}))|items|licenses|namespaces|organizations|profiles|users)$"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "gcat",
|
||||
"calledMethod": "list ${Collection}"
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
DataCatalogue,science-catalogue,/items/ABCD/resources/EFGH
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(DataCatalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "(science-catalogue)|(gcat)|(gCat)",
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1}){0,1}items\/[%0-9a-zA-Z\\-_]*\/resources\/[%0-9a-zA-Z\\-_]*$"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "gcat",
|
||||
"calledMethod": "read resource"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,2 @@
|
|||
DataCatalogue,science-catalogue,/items/ABCD/resources
|
||||
DataCatalogue,science-catalogue,/items/restful_transaction_model/resources
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"match": {
|
||||
"serviceClassRegex": "(DataCatalogue)|(DataPublishing)",
|
||||
"serviceNameRegex": "(science-catalogue)|(gcat)|(gCat)",
|
||||
"calledMethodRegex": "(\/){0,1}(rest\/(api\/){0,1}){0,1}items\/[%0-9a-zA-Z\\-_]*\/resources$"
|
||||
},
|
||||
"replace": {
|
||||
"serviceClass": "DataPublishing",
|
||||
"serviceName": "gcat",
|
||||
"calledMethod": "list resources"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue