Fixed rules and added new ones

This commit is contained in:
Luca Frosini 2020-03-25 14:57:47 +01:00
parent 650244485c
commit a59c89ae8f
18 changed files with 188 additions and 27 deletions

View File

@ -216,8 +216,8 @@ public class TestRules extends ContextTest {
public void testSingleRule() throws Exception {
allRules();
File rulesDirectory = getRulesDirectory();
File rulesDirFile = new File(rulesDirectory, "AllServices");
File rulesFile = new File(rulesDirFile, "AllServices-OTHER.json");
File rulesDirFile = new File(rulesDirectory, "geoanalytics-gos");
File rulesFile = new File(rulesDirFile, "geoanalytics-gos-OTHER.json");
testRule(rulesFile);
}
@ -233,13 +233,13 @@ public class TestRules extends ContextTest {
@Test
public void testMatcherReplace() throws Exception {
File rulesDirectory = getRulesDirectory();
File rulesDirFile = new File(rulesDirectory, "FullTextIndexNode");
File rulesFile = new File(rulesDirFile, "FullTextIndexNode-OTHER.json");
File rulesDirFile = new File(rulesDirectory, "geoanalytics-gos");
File rulesFile = new File(rulesDirFile, "geoanalytics-gos-OTHER.json");
ObjectMapper mapper = DSMapper.getObjectMapper();
MatcherReplace matcherReplace = mapper.readValue(rulesFile, MatcherReplace.class);
Replace replace = matcherReplace.check("Index","FullTextIndexNode","/delete/1b9c6e34baddd4cebe9215fd381a63f4f17957f3463f94675c9d656148b99311/oai:archimer.ifremer.fr:11267");
Replace replace = matcherReplace.check("geoanalytics","geoanalytics-gos-gos","/ShapeManagement/applyOnView");
logger.info("{}", replace);

View File

@ -0,0 +1,13 @@
Data-Catalogue,Catalogue-WS,/rest/api/organisations/list
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list
Data-Catalogue,Catalogue-WS,/rest/api/organisation/list
Data-Catalogue,Catalogue-WS,/rest/api/organization/list
Data-Catalogue,Catalogue-WS,/rest/api/organisations/list/
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list%3fall_fields
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list%3fall_fields=true
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list%3finclude_dataset_count
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list%3finclude_dataset_count=true
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list%3flimit=2
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list%3foffset=2
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list%3forder_by=name
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list/%3finclude_dataset_count=true
1 Data-Catalogue Catalogue-WS /rest/api/organisations/list
2 Data-Catalogue Catalogue-WS /rest/api/organizations/list
3 Data-Catalogue Catalogue-WS /rest/api/organisation/list
4 Data-Catalogue Catalogue-WS /rest/api/organization/list
5 Data-Catalogue Catalogue-WS /rest/api/organisations/list/
6 Data-Catalogue Catalogue-WS /rest/api/organizations/list%3fall_fields
7 Data-Catalogue Catalogue-WS /rest/api/organizations/list%3fall_fields=true
8 Data-Catalogue Catalogue-WS /rest/api/organizations/list%3finclude_dataset_count
9 Data-Catalogue Catalogue-WS /rest/api/organizations/list%3finclude_dataset_count=true
10 Data-Catalogue Catalogue-WS /rest/api/organizations/list%3flimit=2
11 Data-Catalogue Catalogue-WS /rest/api/organizations/list%3foffset=2
12 Data-Catalogue Catalogue-WS /rest/api/organizations/list%3forder_by=name
13 Data-Catalogue Catalogue-WS /rest/api/organizations/list/%3finclude_dataset_count=true

View File

@ -2,7 +2,7 @@
"match": {
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
"serviceNameRegex": "Catalogue-WS",
"calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/list"
"calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/list.*"
},
"replace": {
"serviceClass": "DataPublishing",

View File

@ -1,4 +0,0 @@
Data-Catalogue,Catalogue-WS,/rest/api/organisations/list
Data-Catalogue,Catalogue-WS,/rest/api/organizations/list
Data-Catalogue,Catalogue-WS,/rest/api/organisation/list
Data-Catalogue,Catalogue-WS,/rest/api/organization/list
1 Data-Catalogue Catalogue-WS /rest/api/organisations/list
2 Data-Catalogue Catalogue-WS /rest/api/organizations/list
3 Data-Catalogue Catalogue-WS /rest/api/organisation/list
4 Data-Catalogue Catalogue-WS /rest/api/organization/list

View File

@ -0,0 +1,6 @@
Data-Catalogue,Catalogue-WS,/rest/api/organisations/show%3fid=biodiversitylab
Data-Catalogue,Catalogue-WS,/rest/api/organizations/show
Data-Catalogue,Catalogue-WS,/rest/api/organizations/show%3fid=aquamaps
Data-Catalogue,Catalogue-WS,/rest/api/organizations/show%3fid=biodiversitylab
Data-Catalogue,Catalogue-WS,/rest/api/organizations/show%3fid=egip
Data-Catalogue,Catalogue-WS,/rest/api/organizations/show%3fid=organization_name
1 Data-Catalogue Catalogue-WS /rest/api/organisations/show%3fid=biodiversitylab
2 Data-Catalogue Catalogue-WS /rest/api/organizations/show
3 Data-Catalogue Catalogue-WS /rest/api/organizations/show%3fid=aquamaps
4 Data-Catalogue Catalogue-WS /rest/api/organizations/show%3fid=biodiversitylab
5 Data-Catalogue Catalogue-WS /rest/api/organizations/show%3fid=egip
6 Data-Catalogue Catalogue-WS /rest/api/organizations/show%3fid=organization_name

View File

@ -0,0 +1,12 @@
{
"match": {
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
"serviceNameRegex": "Catalogue-WS",
"calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/show.*"
},
"replace": {
"serviceClass": "DataPublishing",
"serviceName": "Catalogue-WS",
"calledMethod": "showOrganizations"
}
}

View File

@ -0,0 +1,12 @@
{
"match": {
"serviceClassRegex": "(WPS)|(DataAnalysis)",
"serviceNameRegex": "DataMiner",
"calledMethodRegex": "(?<CalledMethod>.*)"
},
"replace": {
"serviceClass": "DataAnalysis",
"serviceName": "DataMiner",
"calledMethod": "${CalledMethod}"
}
}

View File

@ -0,0 +1,4 @@
ResourceManagement,FHNManager,/rest/nodes
ResourceManagement,FHNManager,/rest/resourceTemplate
ResourceManagement,FHNManager,/rest/serviceprofiles
ResourceManagement,FHNManager,/rest/vmproviders
1 ResourceManagement FHNManager /rest/nodes
2 ResourceManagement FHNManager /rest/resourceTemplate
3 ResourceManagement FHNManager /rest/serviceprofiles
4 ResourceManagement FHNManager /rest/vmproviders

View File

@ -0,0 +1,12 @@
{
"match": {
"serviceClassRegex": "ResourceManagement",
"serviceNameRegex": "FHNManager",
"calledMethodRegex": ".*"
},
"replace": {
"serviceClass": "ResourceManagement",
"serviceName": "FHNManager",
"calledMethod": "OTHER"
}
}

View File

@ -2,7 +2,7 @@
"match": {
"serviceClassRegex": "(SDI)|(SpatialData)",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.get(\\..*|\/.*|$)|\\.show(\\..*|$)|((\\.|/)info(\\..*|\\.*|@json|$)))"
"calledMethodRegex": ".*(\\.get(\\..*|\/.*|$)|\\.show(\\..*|$)|((\\.|/)info(?!edit).*))"
},
"replace": {
"serviceClass": "SDI",

View File

@ -0,0 +1,12 @@
DataAccess,HomeLibraryFileSystem,/fs/item/29d9a102-802b-4775-b80d-a42730c643cb/download
DataAccess,HomeLibraryFileSystem,/fs/item/5a045ed3040320012fa636ce/download
DataAccess,HomeLibraryFileSystem,/fs/item/6e9b8350-4854-4c22-8aa1-ba2d8135ad6d/move
DataAccess,HomeLibraryFileSystem,/fs/item/7bb0d323-c1e7-4961-aec3-31f4d9c3179c/download
DataAccess,HomeLibraryFileSystem,/fs/item/8c422f87-4329-4543-a6d3-11e64c68192d/move
DataAccess,HomeLibraryFileSystem,/fs/item/ad8ba805-bcc5-4d0e-90c9-53216970b3e6/move
DataAccess,HomeLibraryFileSystem,/fs/item/download/6e9b8350-4854-4c22-8aa1-ba2d8135ad6d
DataAccess,HomeLibraryFileSystem,/fs/list
DataAccess,HomeLibraryFileSystem,/fs/list/byPath
DataAccess,HomeLibraryFileSystem,/fs/list/usingDif
DataAccess,HomeLibraryFileSystem,/fs/usingDif
DataAccess,HomeLibraryFileSystem,OTHER
1 DataAccess HomeLibraryFileSystem /fs/item/29d9a102-802b-4775-b80d-a42730c643cb/download
2 DataAccess HomeLibraryFileSystem /fs/item/5a045ed3040320012fa636ce/download
3 DataAccess HomeLibraryFileSystem /fs/item/6e9b8350-4854-4c22-8aa1-ba2d8135ad6d/move
4 DataAccess HomeLibraryFileSystem /fs/item/7bb0d323-c1e7-4961-aec3-31f4d9c3179c/download
5 DataAccess HomeLibraryFileSystem /fs/item/8c422f87-4329-4543-a6d3-11e64c68192d/move
6 DataAccess HomeLibraryFileSystem /fs/item/ad8ba805-bcc5-4d0e-90c9-53216970b3e6/move
7 DataAccess HomeLibraryFileSystem /fs/item/download/6e9b8350-4854-4c22-8aa1-ba2d8135ad6d
8 DataAccess HomeLibraryFileSystem /fs/list
9 DataAccess HomeLibraryFileSystem /fs/list/byPath
10 DataAccess HomeLibraryFileSystem /fs/list/usingDif
11 DataAccess HomeLibraryFileSystem /fs/usingDif
12 DataAccess HomeLibraryFileSystem OTHER

View File

@ -0,0 +1,12 @@
{
"match": {
"serviceClassRegex": "DataAccess",
"serviceNameRegex": "HomeLibraryFileSystem",
"calledMethodRegex": ".*"
},
"replace": {
"serviceClass": "DataAccess",
"serviceName": "HomeLibraryFileSystem",
"calledMethod": "OTHER"
}
}

View File

@ -10,6 +10,17 @@
"serviceName": "${ServiceName}",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "(WPS)|(DataAnalysis)",
"serviceNameRegex": "DataMiner",
"calledMethodRegex": "(?<CalledMethod>.*)"
},
"replace": {
"serviceClass": "DataAnalysis",
"serviceName": "DataMiner",
"calledMethod": "${CalledMethod}"
}
},{
"match": {
"serviceClassRegex": "Common",
@ -58,7 +69,7 @@
"match": {
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
"serviceNameRegex": "Catalogue-WS",
"calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/list"
"calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/list.*"
},
"replace": {
"serviceClass": "DataPublishing",
@ -76,6 +87,17 @@
"serviceName": "Catalogue-WS",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "(Data-Catalogue)|(DataPublishing)",
"serviceNameRegex": "Catalogue-WS",
"calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/show.*"
},
"replace": {
"serviceClass": "DataPublishing",
"serviceName": "Catalogue-WS",
"calledMethod": "showOrganizations"
}
},{
"match": {
"serviceClassRegex": "DataAccess",
@ -175,6 +197,17 @@
"serviceName": "data-transfer-service",
"calledMethod": "upload"
}
},{
"match": {
"serviceClassRegex": "ResourceManagement",
"serviceNameRegex": "FHNManager",
"calledMethodRegex": ".*"
},
"replace": {
"serviceClass": "ResourceManagement",
"serviceName": "FHNManager",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "(Index)|(DataRetrieval)",
@ -189,7 +222,7 @@
},{
"match": {
"serviceClassRegex": "(geoanalytics)|(SDI)",
"serviceNameRegex": "(geoanalytics-gos)|(geoanalytics-gos-gos)",
"serviceNameRegex": "geoanalytics-gos.*",
"calledMethodRegex": ".*"
},
"replace": {
@ -256,7 +289,7 @@
"match": {
"serviceClassRegex": "(SDI)|(SpatialData)",
"serviceNameRegex": "GeoNetwork",
"calledMethodRegex": ".*(\\.get(\\..*|\/.*|$)|\\.show(\\..*|$)|((\\.|/)info(\\..*|\\.*|@json|$)))"
"calledMethodRegex": ".*(\\.get(\\..*|\/.*|$)|\\.show(\\..*|$)|((\\.|/)info(?!edit).*))"
},
"replace": {
"serviceClass": "SDI",
@ -363,6 +396,17 @@
"serviceName": "GRSFPublisher",
"calledMethod": "update"
}
},{
"match": {
"serviceClassRegex": "DataAccess",
"serviceNameRegex": "HomeLibraryFileSystem",
"calledMethodRegex": ".*"
},
"replace": {
"serviceClass": "DataAccess",
"serviceName": "HomeLibraryFileSystem",
"calledMethod": "OTHER"
}
},{
"match": {
"serviceClassRegex": "DataAnalysis",

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,13 +1,13 @@
#!/bin/bash
echo "[" > allRules.json
cat ./AllServices-OTHER.json >> allRules.json
cat **/*.json >> allRules.json
echo "]" >> allRules.json
sed -i 's/}{/},{/g' allRules.json
echo "[" > allRules.json.full
cat ./*.json >> allRules.json.full
cat **/*.json >> allRules.json.full
echo "]" >> allRules.json.full
sed -i 's/}{/},{/g' allRules.json.full
tr -d '\n' < allRules.json > allRules.min.json
sed -i 's/\t//g' allRules.min.json
sed -i 's/ / /g' allRules.min.json
sed -i 's/": "/":"/g' allRules.min.json
sed -i 's/": {/":{/g' allRules.min.json
tr -d '\n' < allRules.json.full > allRules.json.min
sed -i 's/\t//g' allRules.json.min
sed -i 's/ / /g' allRules.json.min
sed -i 's/": "/":"/g' allRules.json.min
sed -i 's/": {/":{/g' allRules.json.min

View File

@ -36,3 +36,41 @@ geoanalytics,geoanalytics-gos-gos,/ShapeManagement/deleteLayer/{UUID_TO_REPLACE}
geoanalytics,geoanalytics-gos-gos,/ShapeManagement/getShapeByID/{UUID_TO_REPLACE}
geoanalytics,geoanalytics-gos-gos,/ShapeManagement/insertShapes
geoanalytics,geoanalytics-gos-gos,/ShapeManagement/shapesOfLayerID/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/GeoserverManagement/addGeoserverLayer
SDI,geoanalytics-gos,/GeoserverManagement/addStyle
SDI,geoanalytics-gos,/GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}/PostGIS
SDI,geoanalytics-gos,/GeoserverManagement/getAllStyles
SDI,geoanalytics-gos,/GeoserverManagement/getFeatureType/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/GeoserverManagement/getGeoserverLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/GeoserverManagement/getGeoserverLayers
SDI,geoanalytics-gos,/GeoserverManagement/getLayerType/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/GeoserverManagement/initializeEnvironment
SDI,geoanalytics-gos,/GeoserverManagement/removeStyle
SDI,geoanalytics-gos,/GeoserverManagement/setDefaultLayerStyle
SDI,geoanalytics-gos,/ShapeManagement/existingLayerIDs
SDI,geoanalytics-gos,/ShapeManagement/applyOnView
SDI,geoanalytics-gos,/ShapeManagement/countShapesOfLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/ShapeManagement/deleteLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/ShapeManagement/getShapeByID/{UUID_TO_REPLACE}
SDI,geoanalytics-gos,/ShapeManagement/insertShapes
SDI,geoanalytics-gos,/ShapeManagement/shapesOfLayerID/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/GeoserverManagement/addGeoserverLayer
SDI,geoanalytics-gos-gos,/GeoserverManagement/addStyle
SDI,geoanalytics-gos-gos,/GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}/PostGIS
SDI,geoanalytics-gos-gos,/GeoserverManagement/getAllStyles
SDI,geoanalytics-gos-gos,/GeoserverManagement/getFeatureType/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/GeoserverManagement/getGeoserverLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/GeoserverManagement/getGeoserverLayers
SDI,geoanalytics-gos-gos,/GeoserverManagement/getLayerType/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/GeoserverManagement/initializeEnvironment
SDI,geoanalytics-gos-gos,/GeoserverManagement/removeStyle
SDI,geoanalytics-gos-gos,/GeoserverManagement/setDefaultLayerStyle
SDI,geoanalytics-gos-gos,/ShapeManagement/existingLayerIDs
SDI,geoanalytics-gos-gos,/ShapeManagement/applyOnView
SDI,geoanalytics-gos-gos,/ShapeManagement/countShapesOfLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/ShapeManagement/deleteLayer/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/ShapeManagement/getShapeByID/{UUID_TO_REPLACE}
SDI,geoanalytics-gos-gos,/ShapeManagement/insertShapes
SDI,geoanalytics-gos-gos,/ShapeManagement/shapesOfLayerID/{UUID_TO_REPLACE}
1 geoanalytics geoanalytics-gos /GeoserverManagement/addGeoserverLayer
36 geoanalytics geoanalytics-gos-gos /ShapeManagement/getShapeByID/{UUID_TO_REPLACE}
37 geoanalytics geoanalytics-gos-gos /ShapeManagement/insertShapes
38 geoanalytics geoanalytics-gos-gos /ShapeManagement/shapesOfLayerID/{UUID_TO_REPLACE}
39 SDI geoanalytics-gos /GeoserverManagement/addGeoserverLayer
40 SDI geoanalytics-gos /GeoserverManagement/addStyle
41 SDI geoanalytics-gos /GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}
42 SDI geoanalytics-gos /GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}/PostGIS
43 SDI geoanalytics-gos /GeoserverManagement/getAllStyles
44 SDI geoanalytics-gos /GeoserverManagement/getFeatureType/{UUID_TO_REPLACE}
45 SDI geoanalytics-gos /GeoserverManagement/getGeoserverLayer/{UUID_TO_REPLACE}
46 SDI geoanalytics-gos /GeoserverManagement/getGeoserverLayers
47 SDI geoanalytics-gos /GeoserverManagement/getLayerType/{UUID_TO_REPLACE}
48 SDI geoanalytics-gos /GeoserverManagement/initializeEnvironment
49 SDI geoanalytics-gos /GeoserverManagement/removeStyle
50 SDI geoanalytics-gos /GeoserverManagement/setDefaultLayerStyle
51 SDI geoanalytics-gos /ShapeManagement/existingLayerIDs
52 SDI geoanalytics-gos /ShapeManagement/applyOnView
53 SDI geoanalytics-gos /ShapeManagement/countShapesOfLayer/{UUID_TO_REPLACE}
54 SDI geoanalytics-gos /ShapeManagement/deleteLayer/{UUID_TO_REPLACE}
55 SDI geoanalytics-gos /ShapeManagement/getShapeByID/{UUID_TO_REPLACE}
56 SDI geoanalytics-gos /ShapeManagement/insertShapes
57 SDI geoanalytics-gos /ShapeManagement/shapesOfLayerID/{UUID_TO_REPLACE}
58 SDI geoanalytics-gos-gos /GeoserverManagement/addGeoserverLayer
59 SDI geoanalytics-gos-gos /GeoserverManagement/addStyle
60 SDI geoanalytics-gos-gos /GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}
61 SDI geoanalytics-gos-gos /GeoserverManagement/deleteGeoserverLayer/{UUID_TO_REPLACE}/PostGIS
62 SDI geoanalytics-gos-gos /GeoserverManagement/getAllStyles
63 SDI geoanalytics-gos-gos /GeoserverManagement/getFeatureType/{UUID_TO_REPLACE}
64 SDI geoanalytics-gos-gos /GeoserverManagement/getGeoserverLayer/{UUID_TO_REPLACE}
65 SDI geoanalytics-gos-gos /GeoserverManagement/getGeoserverLayers
66 SDI geoanalytics-gos-gos /GeoserverManagement/getLayerType/{UUID_TO_REPLACE}
67 SDI geoanalytics-gos-gos /GeoserverManagement/initializeEnvironment
68 SDI geoanalytics-gos-gos /GeoserverManagement/removeStyle
69 SDI geoanalytics-gos-gos /GeoserverManagement/setDefaultLayerStyle
70 SDI geoanalytics-gos-gos /ShapeManagement/existingLayerIDs
71 SDI geoanalytics-gos-gos /ShapeManagement/applyOnView
72 SDI geoanalytics-gos-gos /ShapeManagement/countShapesOfLayer/{UUID_TO_REPLACE}
73 SDI geoanalytics-gos-gos /ShapeManagement/deleteLayer/{UUID_TO_REPLACE}
74 SDI geoanalytics-gos-gos /ShapeManagement/getShapeByID/{UUID_TO_REPLACE}
75 SDI geoanalytics-gos-gos /ShapeManagement/insertShapes
76 SDI geoanalytics-gos-gos /ShapeManagement/shapesOfLayerID/{UUID_TO_REPLACE}

View File

@ -1,7 +1,7 @@
{
"match": {
"serviceClassRegex": "(geoanalytics)|(SDI)",
"serviceNameRegex": "(geoanalytics-gos)|(geoanalytics-gos-gos)",
"serviceNameRegex": "geoanalytics-gos.*",
"calledMethodRegex": ".*"
},
"replace": {