From 1deed3256ba01e873926b05a51605ec7b231bf89 Mon Sep 17 00:00:00 2001 From: Luca Frosini Date: Thu, 12 Mar 2020 19:47:10 +0100 Subject: [PATCH] Added rules for resource-registry --- allRules-min.json | 1 + allRules.json | 717 ++++++++++++++++++ .../validations/validators/TestRules.java | 4 +- src/test/resources/rule.json | 13 - .../Catalogue-WS-organizations.json | 2 +- ...-OTHER.csv => resource-registry-OTHER.csv} | 0 src/test/resources/test.log | 1 - 7 files changed, 721 insertions(+), 17 deletions(-) create mode 100644 allRules-min.json create mode 100644 allRules.json delete mode 100644 src/test/resources/rule.json rename src/test/resources/rules/resource-registry/{resource-regsitry-OTHER.csv => resource-registry-OTHER.csv} (100%) delete mode 100644 src/test/resources/test.log diff --git a/allRules-min.json b/allRules-min.json new file mode 100644 index 0000000..b4993ff --- /dev/null +++ b/allRules-min.json @@ -0,0 +1 @@ +[{"match":{"serviceClassRegex":"Common","serviceNameRegex":"AuthorizationService","calledMethodRegex":"^/{0,1}gcube/service/generate.*"},"replace":{"serviceClass":"Common","serviceName":"AuthorizationService","calledMethod":"generate"}},{"match":{"serviceClassRegex":"Common","serviceNameRegex":"AuthorizationService","calledMethodRegex":"^/{0,1}gcube/service/retrieve.*"},"replace":{"serviceClass":"Common","serviceName":"AuthorizationService","calledMethod":"retrieve"}},{"match":{"serviceClassRegex":"Common","serviceNameRegex":"AuthorizationService","calledMethodRegex":"^((e/)|/){0,1}gcube/resource/scopes"},"replace":{"serviceClass":"Common","serviceName":"AuthorizationService","calledMethod":"scopes"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"Catalogue-WS","calledMethodRegex":"^/rest/(api/){0,1}licenses/list"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"Catalogue-WS","calledMethod":"/rest/api/licenses/list"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"Catalogue-WS","calledMethodRegex":"^/rest/api/organi(s|z)ation(s){0,1}/list"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"Catalogue-WS","calledMethod":"/rest/api/organizations/list"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"Catalogue-WS","calledMethodRegex":"^/rest$|^UNKNOWN|^OTHER$"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"Catalogue-WS","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"DataAccess","serviceNameRegex":"CkanConnector","calledMethodRegex":"^/{0,1}gcube/service/connect.*"},"replace":{"serviceClass":"DataAccess","serviceName":"CkanConnector","calledMethod":"connect"}},{"match":{"serviceClassRegex":"DataAccess","serviceNameRegex":"CkanConnector","calledMethodRegex":"^/{0,1}gcube/service/disconnect.*"},"replace":{"serviceClass":"DataAccess","serviceName":"CkanConnector","calledMethod":"disconnect"}},{"match":{"serviceClassRegex":"WPS","serviceNameRegex":"DataMiner","calledMethodRegex":"^/{0,1}DescribeProcess.*"},"replace":{"serviceClass":"WPS","serviceName":"DataMiner","calledMethod":"describeProcess"}},{"match":{"serviceClassRegex":"WPS","serviceNameRegex":"DataMiner","calledMethodRegex":"^/{0,1}GetCapabilities.*"},"replace":{"serviceClass":"WPS","serviceName":"DataMiner","calledMethod":"getCapabilities"}},{"match":{"serviceClassRegex":"WPS","serviceNameRegex":"DataMiner","calledMethodRegex":"^/{0,1}RetrieveResult.*"},"replace":{"serviceClass":"WPS","serviceName":"DataMiner","calledMethod":"getResult"}},{"match":{"serviceClassRegex":"WPS","serviceNameRegex":"DataMiner","calledMethodRegex":"^/{0,1}(WebProcessingService|UNKNOWN|OTHER|gcube/resource/scopes).*"},"replace":{"serviceClass":"WPS","serviceName":"DataMiner","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"WPS","serviceNameRegex":"DataMiner","calledMethodRegex":"^/{0,1}CancelComputation.*"},"replace":{"serviceClass":"WPS","serviceName":"DataMiner","calledMethod":"stop"}},{"match":{"serviceClassRegex":"DataTransfer","serviceNameRegex":"data-transfer-service","calledMethodRegex":".*Capabilities.*"},"replace":{"serviceClass":"DataTransfer","serviceName":"data-transfer-service","calledMethod":"getCapabilities"}},{"match":{"serviceClassRegex":"DataTransfer","serviceNameRegex":"data-transfer-service","calledMethodRegex":".*FileUpload.*"},"replace":{"serviceClass":"DataTransfer","serviceName":"data-transfer-service","calledMethod":"upload"}},{"match":{"serviceClassRegex":"Index","serviceNameRegex":"FullTextIndexNode","calledMethodRegex":"^/{0,1}delete.*"},"replace":{"serviceClass":"Index","serviceName":"FullTextIndexNode","calledMethod":"delete"}},{"match":{"serviceClassRegex":"Index","serviceNameRegex":"FullTextIndexNode","calledMethodRegex":"^/{0,1}dropCollection.*"},"replace":{"serviceClass":"Index","serviceName":"FullTextIndexNode","calledMethod":"dropCollection"}},{"match":{"serviceClassRegex":"Index","serviceNameRegex":"FullTextIndexNode","calledMethodRegex":"^/{0,1}insert.*"},"replace":{"serviceClass":"Index","serviceName":"FullTextIndexNode","calledMethod":"insert"}},{"match":{"serviceClassRegex":"Index","serviceNameRegex":"FullTextIndexNode","calledMethodRegex":"^/{0,1}listCollections.*"},"replace":{"serviceClass":"Index","serviceName":"FullTextIndexNode","calledMethod":"listCollections"}},{"match":{"serviceClassRegex":"Index","serviceNameRegex":"FullTextIndexNode","calledMethodRegex":"^/{0,1}search.*"},"replace":{"serviceClass":"Index","serviceName":"FullTextIndexNode","calledMethod":"search"}},{"match":{"serviceClassRegex":"geoanalytics","serviceNameRegex":"geoanalytics-gos","calledMethodRegex":".*GeoserverManagement.*"},"replace":{"serviceClass":"geoanalytics","serviceName":"geoanalytics-gos","calledMethod":"GeoserverManagement"}},{"match":{"serviceClassRegex":"geoanalytics","serviceNameRegex":"geoanalytics-gos","calledMethodRegex":".*ShapeManagement.*"},"replace":{"serviceClass":"geoanalytics","serviceName":"geoanalytics-gos","calledMethod":"ShapeManagement"}},{"match":{"serviceClassRegex":"geoanalytics","serviceNameRegex":"geoanalytics-main-service","calledMethodRegex":".*"},"replace":{"serviceClass":"geoanalytics","serviceName":"geoanalytics-main-service","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"GeoNetwork","calledMethodRegex":".*(\\.create(\\.form){0,1}|\\.insert|\\.xmlinsert\\.form)$"},"replace":{"serviceClass":"SDI","serviceName":"GeoNetwork","calledMethod":"create"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"GeoNetwork","calledMethodRegex":".*(\\.delete(\\.batch|@json|$))"},"replace":{"serviceClass":"SDI","serviceName":"GeoNetwork","calledMethod":"delete"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"GeoNetwork","calledMethodRegex":".*(\\.list(@json|$))"},"replace":{"serviceClass":"SDI","serviceName":"GeoNetwork","calledMethod":"list"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"GeoNetwork","calledMethodRegex":"^(?!.*(read|create|insert|delete|list|get|show|info|search|update|edit)).*$|^(.*(updated|editors|pwupdate|(systeminfo.*)|forget-password|getmap.png|(GetCapabilities.*)|(/codelists/.*)))$"},"replace":{"serviceClass":"SDI","serviceName":"GeoNetwork","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"GeoNetwork","calledMethodRegex":".*(\\.get(\\..*|/.*|$)|\\.show(\\..*|$)|((\\.|/)info(\\..*|\\.*|@json|$)))"},"replace":{"serviceClass":"SDI","serviceName":"GeoNetwork","calledMethod":"read"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"GeoNetwork","calledMethodRegex":".*(\\.|-|/|package_|open)search(/.*|unused(.form){0,1}|\\..*|;jsessionid=.*|-.*|$)"},"replace":{"serviceClass":"SDI","serviceName":"GeoNetwork","calledMethod":"search"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"GeoNetwork","calledMethodRegex":".*(\\.update($|\\.finish)|\\.edit(!{0,1}|\\.save(only){0,1}|\\.commit)$|\\.infoedit$|\\.pwedit$)"},"replace":{"serviceClass":"SDI","serviceName":"GeoNetwork","calledMethod":"update"}},{"match":{"serviceClassRegex":"(GeoServer)|(geoserver)|(SpatialData)","serviceNameRegex":"(GeoServer)|(geoserver)","calledMethodRegex":"^(?!.*/(wfs|wms|wcs|wmts)).*$"},"replace":{"serviceClass":"GeoServer","serviceName":"GeoServer","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"(GeoServer)|(geoserver)|(SpatialData)","serviceNameRegex":"(GeoServer)|(geoserver)","calledMethodRegex":"^.*/(?(wfs|wms|wcs|wmts)).*$"},"replace":{"serviceClass":"GeoServer","serviceName":"GeoServer","calledMethod":"/${Protocol}","_comment":"Do not remove the initial / to avoid that wms is replaced with OTHER"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"GRSFPublisher","calledMethodRegex":".*publish-product.*"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"GRSFPublisher","calledMethod":"create"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"GRSFPublisher","calledMethodRegex":".*delete-product.*"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"GRSFPublisher","calledMethod":"delete"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"GRSFPublisher","calledMethodRegex":".*get-catalogue-id-(and-url-){0,1}from-name.*"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"GRSFPublisher","calledMethod":"getURLandIdFromName"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"GRSFPublisher","calledMethodRegex":".*(hello)|(UNKNOWN)|(OTHER).*"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"GRSFPublisher","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"Data-Catalogue","serviceNameRegex":"GRSFPublisher","calledMethodRegex":".*update-product.*"},"replace":{"serviceClass":"Data-Catalogue","serviceName":"GRSFPublisher","calledMethod":"update"}},{"match":{"serviceClassRegex":"DataAnalysis","serviceNameRegex":"RConnector","calledMethodRegex":"^/{0,1}gcube/service/connect.*"},"replace":{"serviceClass":"DataAnalysis","serviceName":"RConnector","calledMethod":"connect"}},{"match":{"serviceClassRegex":"DataAnalysis","serviceNameRegex":"RConnector","calledMethodRegex":"UNKNOWN|OTHER|^/{0,1}gcube/resource/scopes"},"replace":{"serviceClass":"DataAnalysis","serviceName":"RConnector","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"InformationSystem","serviceNameRegex":"resource-registry","calledMethodRegex":"^(?!(GET|HEAD|POST|PUT|DELETE|PURGE|OPTIONS|TRACE|CONNECT))/.*"},"replace":{"serviceClass":"InformationSystem","serviceName":"resource-registry","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"DataAccess","serviceNameRegex":"ShareLatex","calledMethodRegex":"^/{0,1}gcube/service/connect.*"},"replace":{"serviceClass":"DataAccess","serviceName":"ShareLatex","calledMethod":"connect"}},{"match":{"serviceClassRegex":"DataAccess","serviceNameRegex":"ShareLatex","calledMethodRegex":"^/{0,1}gcube/service/disconnect.*"},"replace":{"serviceClass":"DataAccess","serviceName":"ShareLatex","calledMethod":"disconnect"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*BroodstockQuality.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"BroodstockQuality"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*CurrentRating.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"CurrentRating"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*FeedQuality.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"FeedQuality"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*Modeler.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"Modeler"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*Called Method.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*OxygenRating.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"OxygenRating"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*Region.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"Region"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*Scenario.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"Scenario"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*Site.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"Site"}},{"match":{"serviceClassRegex":"Search","serviceNameRegex":"SimulFishGrowthData","calledMethodRegex":".*Species.*"},"replace":{"serviceClass":"Search","serviceName":"SimulFishGrowthData","calledMethod":"Species"}},{"match":{"serviceClassRegex":"VREManagement","serviceNameRegex":"(SmartExecutor)|(smart-executor)","calledMethodRegex":".*((launch)|(execute)|(POST .*executions)).*"},"replace":{"serviceClass":"VREManagement","serviceName":"smart-executor","calledMethod":"execute"}},{"match":{"serviceClassRegex":"VREManagement","serviceNameRegex":"(SmartExecutor)|(smart-executor)","calledMethodRegex":".*((getAvailablePlugins.*)|(GET /plugins(/){0,1}$))"},"replace":{"serviceClass":"VREManagement","serviceName":"smart-executor","calledMethod":"getAvailablePlugins"}},{"match":{"serviceClassRegex":"VREManagement","serviceNameRegex":"(SmartExecutor)|(smart-executor)","calledMethodRegex":".*((getScheduledExecution.*)|(GET .*executions(/){0,1}$))"},"replace":{"serviceClass":"VREManagement","serviceName":"smart-executor","calledMethod":"getScheduledExecution"}},{"match":{"serviceClassRegex":"VREManagement","serviceNameRegex":"(SmartExecutor)|(smart-executor)","calledMethodRegex":".*((getStateEvolution)|(getState)|(GET .*executions/.{1,})).*"},"replace":{"serviceClass":"VREManagement","serviceName":"smart-executor","calledMethod":"getState"}},{"match":{"serviceClassRegex":"VREManagement","serviceNameRegex":"(SmartExecutor)|(smart-executor)","calledMethodRegex":".*(UNKNOWN)|(OTHER).*"},"replace":{"serviceClass":"VREManagement","serviceName":"smart-executor","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"VREManagement","serviceNameRegex":"(SmartExecutor)|(smart-executor)","calledMethodRegex":".*((stop)|(unSchedule)|(DELETE)|(PURGE)).*"},"replace":{"serviceClass":"VREManagement","serviceName":"smart-executor","calledMethod":"stop"}},{"match":{"serviceClassRegex":"content-management","serviceNameRegex":"storage","calledMethodRegex":".*"},"replace":{"serviceClass":"content-management","serviceName":"storage","calledMethod":"OTHER"}},{"match":{"serviceClassRegex":"Application|DataAnalysis","serviceNameRegex":"TagMe","calledMethodRegex":"^((e/)|/){0,1}tag"},"replace":{"serviceClass":"Application","serviceName":"TagMe","calledMethod":"tag"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"Thredds","calledMethodRegex":"^(/){1}(?[a-zA-Z0-9]*){1}(/public/netcdf/){1}(?[a-zA-Z0-9_-]*(?[a-zA-Z0-9]*){1}(/public/netcdf/){1}[^/]*((?[a-zA-Z0-9]*){1}(/public/netcdf/){1}(?[a-zA-Z0-9_-]*)(/){1}(.*\\.(nc|asc|tiff))$"},"replace":{"serviceClass":"SDI","serviceName":"Thredds","calledMethod":"${Protocol}::${Collection}"}},{"match":{"serviceClassRegex":"SDI","serviceNameRegex":"Thredds","calledMethodRegex":"^(/){1}(?[a-zA-Z0-9]*){1}(/public/netcdf/){1}[^/]*(\\.(nc|asc|tiff))$"},"replace":{"serviceClass":"SDI","serviceName":"Thredds","calledMethod":"${Protocol}::OTHER"}}] diff --git a/allRules.json b/allRules.json new file mode 100644 index 0000000..8704b73 --- /dev/null +++ b/allRules.json @@ -0,0 +1,717 @@ +[{ + "match": { + "serviceClassRegex": "Common", + "serviceNameRegex": "AuthorizationService", + "calledMethodRegex": "^/{0,1}gcube/service/generate.*" + }, + "replace": { + "serviceClass": "Common", + "serviceName": "AuthorizationService", + "calledMethod": "generate" + } +},{ + "match": { + "serviceClassRegex": "Common", + "serviceNameRegex": "AuthorizationService", + "calledMethodRegex": "^/{0,1}gcube/service/retrieve.*" + }, + "replace": { + "serviceClass": "Common", + "serviceName": "AuthorizationService", + "calledMethod": "retrieve" + } +},{ + "match": { + "serviceClassRegex": "Common", + "serviceNameRegex": "AuthorizationService", + "calledMethodRegex": "^((e\/)|\/){0,1}gcube\/resource\/scopes" + }, + "replace": { + "serviceClass": "Common", + "serviceName": "AuthorizationService", + "calledMethod": "scopes" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "Catalogue-WS", + "calledMethodRegex": "^\/rest\/(api\/){0,1}licenses\/list" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "Catalogue-WS", + "calledMethod": "/rest/api/licenses/list" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "Catalogue-WS", + "calledMethodRegex": "^\/rest\/api\/organi(s|z)ation(s){0,1}\/list" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "Catalogue-WS", + "calledMethod": "/rest/api/organizations/list" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "Catalogue-WS", + "calledMethodRegex": "^\/rest$|^UNKNOWN|^OTHER$" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "Catalogue-WS", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "DataAccess", + "serviceNameRegex": "CkanConnector", + "calledMethodRegex": "^\/{0,1}gcube\/service\/connect.*" + }, + "replace": { + "serviceClass": "DataAccess", + "serviceName": "CkanConnector", + "calledMethod": "connect" + } +},{ + "match": { + "serviceClassRegex": "DataAccess", + "serviceNameRegex": "CkanConnector", + "calledMethodRegex": "^\/{0,1}gcube\/service\/disconnect.*" + }, + "replace": { + "serviceClass": "DataAccess", + "serviceName": "CkanConnector", + "calledMethod": "disconnect" + } +},{ + "match": { + "serviceClassRegex": "WPS", + "serviceNameRegex": "DataMiner", + "calledMethodRegex": "^/{0,1}DescribeProcess.*" + }, + "replace": { + "serviceClass": "WPS", + "serviceName": "DataMiner", + "calledMethod": "describeProcess" + } +},{ + "match": { + "serviceClassRegex": "WPS", + "serviceNameRegex": "DataMiner", + "calledMethodRegex": "^/{0,1}GetCapabilities.*" + }, + "replace": { + "serviceClass": "WPS", + "serviceName": "DataMiner", + "calledMethod": "getCapabilities" + } +},{ + "match": { + "serviceClassRegex": "WPS", + "serviceNameRegex": "DataMiner", + "calledMethodRegex": "^/{0,1}RetrieveResult.*" + }, + "replace": { + "serviceClass": "WPS", + "serviceName": "DataMiner", + "calledMethod": "getResult" + } +},{ + "match": { + "serviceClassRegex": "WPS", + "serviceNameRegex": "DataMiner", + "calledMethodRegex": "^/{0,1}(WebProcessingService|UNKNOWN|OTHER|gcube\/resource\/scopes).*" + }, + "replace": { + "serviceClass": "WPS", + "serviceName": "DataMiner", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "WPS", + "serviceNameRegex": "DataMiner", + "calledMethodRegex": "^/{0,1}CancelComputation.*" + }, + "replace": { + "serviceClass": "WPS", + "serviceName": "DataMiner", + "calledMethod": "stop" + } +},{ + "match": { + "serviceClassRegex": "DataTransfer", + "serviceNameRegex": "data-transfer-service", + "calledMethodRegex": ".*Capabilities.*" + }, + "replace": { + "serviceClass": "DataTransfer", + "serviceName": "data-transfer-service", + "calledMethod": "getCapabilities" + } +},{ + "match": { + "serviceClassRegex": "DataTransfer", + "serviceNameRegex": "data-transfer-service", + "calledMethodRegex": ".*FileUpload.*" + }, + "replace": { + "serviceClass": "DataTransfer", + "serviceName": "data-transfer-service", + "calledMethod": "upload" + } +},{ + "match": { + "serviceClassRegex": "Index", + "serviceNameRegex": "FullTextIndexNode", + "calledMethodRegex": "^\/{0,1}delete.*" + }, + "replace": { + "serviceClass": "Index", + "serviceName": "FullTextIndexNode", + "calledMethod": "delete" + } +},{ + "match": { + "serviceClassRegex": "Index", + "serviceNameRegex": "FullTextIndexNode", + "calledMethodRegex": "^\/{0,1}dropCollection.*" + }, + "replace": { + "serviceClass": "Index", + "serviceName": "FullTextIndexNode", + "calledMethod": "dropCollection" + } +},{ + "match": { + "serviceClassRegex": "Index", + "serviceNameRegex": "FullTextIndexNode", + "calledMethodRegex": "^\/{0,1}insert.*" + }, + "replace": { + "serviceClass": "Index", + "serviceName": "FullTextIndexNode", + "calledMethod": "insert" + } +},{ + "match": { + "serviceClassRegex": "Index", + "serviceNameRegex": "FullTextIndexNode", + "calledMethodRegex": "^\/{0,1}listCollections.*" + }, + "replace": { + "serviceClass": "Index", + "serviceName": "FullTextIndexNode", + "calledMethod": "listCollections" + } +},{ + "match": { + "serviceClassRegex": "Index", + "serviceNameRegex": "FullTextIndexNode", + "calledMethodRegex": "^\/{0,1}search.*" + }, + "replace": { + "serviceClass": "Index", + "serviceName": "FullTextIndexNode", + "calledMethod": "search" + } +},{ + "match": { + "serviceClassRegex": "geoanalytics", + "serviceNameRegex": "geoanalytics-gos", + "calledMethodRegex": ".*GeoserverManagement.*" + }, + "replace": { + "serviceClass": "geoanalytics", + "serviceName": "geoanalytics-gos", + "calledMethod": "GeoserverManagement" + } +},{ + "match": { + "serviceClassRegex": "geoanalytics", + "serviceNameRegex": "geoanalytics-gos", + "calledMethodRegex": ".*ShapeManagement.*" + }, + "replace": { + "serviceClass": "geoanalytics", + "serviceName": "geoanalytics-gos", + "calledMethod": "ShapeManagement" + } +},{ + "match": { + "serviceClassRegex": "geoanalytics", + "serviceNameRegex": "geoanalytics-main-service", + "calledMethodRegex": ".*" + }, + "replace": { + "serviceClass": "geoanalytics", + "serviceName": "geoanalytics-main-service", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "GeoNetwork", + "calledMethodRegex": ".*(\\.create(\\.form){0,1}|\\.insert|\\.xmlinsert\\.form)$" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "GeoNetwork", + "calledMethod": "create" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "GeoNetwork", + "calledMethodRegex": ".*(\\.delete(\\.batch|@json|$))" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "GeoNetwork", + "calledMethod": "delete" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "GeoNetwork", + "calledMethodRegex": ".*(\\.list(@json|$))" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "GeoNetwork", + "calledMethod": "list" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "GeoNetwork", + "calledMethodRegex": "^(?!.*(read|create|insert|delete|list|get|show|info|search|update|edit)).*$|^(.*(updated|editors|pwupdate|(systeminfo.*)|forget-password|getmap.png|(GetCapabilities.*)|(\/codelists\/.*)))$" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "GeoNetwork", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "GeoNetwork", + "calledMethodRegex": ".*(\\.get(\\..*|\/.*|$)|\\.show(\\..*|$)|((\\.|/)info(\\..*|\\.*|@json|$)))" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "GeoNetwork", + "calledMethod": "read" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "GeoNetwork", + "calledMethodRegex": ".*(\\.|-|/|package_|open)search(\/.*|unused(.form){0,1}|\\..*|;jsessionid=.*|-.*|$)" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "GeoNetwork", + "calledMethod": "search" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "GeoNetwork", + "calledMethodRegex": ".*(\\.update($|\\.finish)|\\.edit(!{0,1}|\\.save(only){0,1}|\\.commit)$|\\.infoedit$|\\.pwedit$)" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "GeoNetwork", + "calledMethod": "update" + } +},{ + "match": { + "serviceClassRegex": "(GeoServer)|(geoserver)|(SpatialData)", + "serviceNameRegex": "(GeoServer)|(geoserver)", + "calledMethodRegex": "^(?!.*\/(wfs|wms|wcs|wmts)).*$" + }, + "replace": { + "serviceClass": "GeoServer", + "serviceName": "GeoServer", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "(GeoServer)|(geoserver)|(SpatialData)", + "serviceNameRegex": "(GeoServer)|(geoserver)", + "calledMethodRegex": "^.*\/(?(wfs|wms|wcs|wmts)).*$" + }, + "replace": { + "serviceClass": "GeoServer", + "serviceName": "GeoServer", + "calledMethod": "/${Protocol}", + "_comment" : "Do not remove the initial / to avoid that wms is replaced with OTHER" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "GRSFPublisher", + "calledMethodRegex": ".*publish-product.*" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "GRSFPublisher", + "calledMethod": "create" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "GRSFPublisher", + "calledMethodRegex": ".*delete-product.*" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "GRSFPublisher", + "calledMethod": "delete" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "GRSFPublisher", + "calledMethodRegex": ".*get-catalogue-id-(and-url-){0,1}from-name.*" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "GRSFPublisher", + "calledMethod": "getURLandIdFromName" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "GRSFPublisher", + "calledMethodRegex": ".*(hello)|(UNKNOWN)|(OTHER).*" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "GRSFPublisher", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "Data-Catalogue", + "serviceNameRegex": "GRSFPublisher", + "calledMethodRegex": ".*update-product.*" + }, + "replace": { + "serviceClass": "Data-Catalogue", + "serviceName": "GRSFPublisher", + "calledMethod": "update" + } +},{ + "match": { + "serviceClassRegex": "DataAnalysis", + "serviceNameRegex": "RConnector", + "calledMethodRegex": "^\/{0,1}gcube\/service\/connect.*" + }, + "replace": { + "serviceClass": "DataAnalysis", + "serviceName": "RConnector", + "calledMethod": "connect" + } +},{ + "match": { + "serviceClassRegex": "DataAnalysis", + "serviceNameRegex": "RConnector", + "calledMethodRegex": "UNKNOWN|OTHER|^\/{0,1}gcube\/resource\/scopes" + }, + "replace": { + "serviceClass": "DataAnalysis", + "serviceName": "RConnector", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "InformationSystem", + "serviceNameRegex": "resource-registry", + "calledMethodRegex": "^(?!(GET|HEAD|POST|PUT|DELETE|PURGE|OPTIONS|TRACE|CONNECT))\/.*" + }, + "replace": { + "serviceClass": "InformationSystem", + "serviceName": "resource-registry", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "DataAccess", + "serviceNameRegex": "ShareLatex", + "calledMethodRegex": "^\/{0,1}gcube\/service\/connect.*" + }, + "replace": { + "serviceClass": "DataAccess", + "serviceName": "ShareLatex", + "calledMethod": "connect" + } +},{ + "match": { + "serviceClassRegex": "DataAccess", + "serviceNameRegex": "ShareLatex", + "calledMethodRegex": "^\/{0,1}gcube\/service\/disconnect.*" + }, + "replace": { + "serviceClass": "DataAccess", + "serviceName": "ShareLatex", + "calledMethod": "disconnect" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*BroodstockQuality.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "BroodstockQuality" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*CurrentRating.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "CurrentRating" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*FeedQuality.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "FeedQuality" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*Modeler.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "Modeler" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*Called Method.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*OxygenRating.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "OxygenRating" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*Region.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "Region" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*Scenario.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "Scenario" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*Site.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "Site" + } +},{ + "match": { + "serviceClassRegex": "Search", + "serviceNameRegex": "SimulFishGrowthData", + "calledMethodRegex": ".*Species.*" + }, + "replace": { + "serviceClass": "Search", + "serviceName": "SimulFishGrowthData", + "calledMethod": "Species" + } +},{ + "match": { + "serviceClassRegex": "VREManagement", + "serviceNameRegex": "(SmartExecutor)|(smart-executor)", + "calledMethodRegex": ".*((launch)|(execute)|(POST .*executions)).*" + }, + "replace": { + "serviceClass": "VREManagement", + "serviceName": "smart-executor", + "calledMethod": "execute" + } +},{ + "match": { + "serviceClassRegex": "VREManagement", + "serviceNameRegex": "(SmartExecutor)|(smart-executor)", + "calledMethodRegex": ".*((getAvailablePlugins.*)|(GET \/plugins(\/){0,1}$))" + }, + "replace": { + "serviceClass": "VREManagement", + "serviceName": "smart-executor", + "calledMethod": "getAvailablePlugins" + } +},{ + "match": { + "serviceClassRegex": "VREManagement", + "serviceNameRegex": "(SmartExecutor)|(smart-executor)", + "calledMethodRegex": ".*((getScheduledExecution.*)|(GET .*executions(\/){0,1}$))" + }, + "replace": { + "serviceClass": "VREManagement", + "serviceName": "smart-executor", + "calledMethod": "getScheduledExecution" + } +},{ + "match": { + "serviceClassRegex": "VREManagement", + "serviceNameRegex": "(SmartExecutor)|(smart-executor)", + "calledMethodRegex": ".*((getStateEvolution)|(getState)|(GET .*executions\/.{1,})).*" + }, + "replace": { + "serviceClass": "VREManagement", + "serviceName": "smart-executor", + "calledMethod": "getState" + } +},{ + "match": { + "serviceClassRegex": "VREManagement", + "serviceNameRegex": "(SmartExecutor)|(smart-executor)", + "calledMethodRegex": ".*(UNKNOWN)|(OTHER).*" + }, + "replace": { + "serviceClass": "VREManagement", + "serviceName": "smart-executor", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "VREManagement", + "serviceNameRegex": "(SmartExecutor)|(smart-executor)", + "calledMethodRegex": ".*((stop)|(unSchedule)|(DELETE)|(PURGE)).*" + }, + "replace": { + "serviceClass": "VREManagement", + "serviceName": "smart-executor", + "calledMethod": "stop" + } +},{ + "match": { + "serviceClassRegex": "content-management", + "serviceNameRegex": "storage", + "calledMethodRegex": ".*" + }, + "replace": { + "serviceClass": "content-management", + "serviceName": "storage", + "calledMethod": "OTHER" + } +},{ + "match": { + "serviceClassRegex": "Application|DataAnalysis", + "serviceNameRegex": "TagMe", + "calledMethodRegex": "^((e\/)|\/){0,1}tag" + }, + "replace": { + "serviceClass": "Application", + "serviceName": "TagMe", + "calledMethod": "tag" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "Thredds", + "calledMethodRegex": "^(\/){1}(?[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}(?[a-zA-Z0-9_-]*(?[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}[^\/]*((?[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}(?[a-zA-Z0-9_-]*)(\/){1}(.*\\.(nc|asc|tiff))$" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "Thredds", + "calledMethod": "${Protocol}::${Collection}" + } +},{ + "match": { + "serviceClassRegex": "SDI", + "serviceNameRegex": "Thredds", + "calledMethodRegex": "^(\/){1}(?[a-zA-Z0-9]*){1}(\/public\/netcdf\/){1}[^\/]*(\\.(nc|asc|tiff))$" + }, + "replace": { + "serviceClass": "SDI", + "serviceName": "Thredds", + "calledMethod": "${Protocol}::OTHER" + } +}] 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 7848a88..7864919 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 @@ -211,8 +211,8 @@ public class TestRules extends ContextTest { public void testSingleRule() throws Exception { allRules(); File rulesDirectory = getRulesDirectory(); - File rulesDirFile = new File(rulesDirectory, "GeoNetwork"); - File rulesFile = new File(rulesDirFile, "GeoNetwork-read.json"); + File rulesDirFile = new File(rulesDirectory, "resource-registry"); + File rulesFile = new File(rulesDirFile, "resource-registry-OTHER.json"); testRule(rulesFile); } diff --git a/src/test/resources/rule.json b/src/test/resources/rule.json deleted file mode 100644 index 35ce2d8..0000000 --- a/src/test/resources/rule.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "match" : { - "serviceClassRegex": "Common", - "serviceNameRegex": "AuthorizationService", - "calledMethodRegex": "^\/{0,1}gcube\/service\/generate.*" - }, - "replace": { - "calledMethod": "generate", - "serviceClass": "Common", - "serviceName": "AuthorizationService" - } - -} diff --git a/src/test/resources/rules/Catalogue-WS/Catalogue-WS-organizations.json b/src/test/resources/rules/Catalogue-WS/Catalogue-WS-organizations.json index d12fa3e..aa81493 100644 --- a/src/test/resources/rules/Catalogue-WS/Catalogue-WS-organizations.json +++ b/src/test/resources/rules/Catalogue-WS/Catalogue-WS-organizations.json @@ -9,4 +9,4 @@ "serviceName": "Catalogue-WS", "calledMethod": "/rest/api/organizations/list" } -} +} \ No newline at end of file diff --git a/src/test/resources/rules/resource-registry/resource-regsitry-OTHER.csv b/src/test/resources/rules/resource-registry/resource-registry-OTHER.csv similarity index 100% rename from src/test/resources/rules/resource-registry/resource-regsitry-OTHER.csv rename to src/test/resources/rules/resource-registry/resource-registry-OTHER.csv diff --git a/src/test/resources/test.log b/src/test/resources/test.log deleted file mode 100644 index 8e5d5a5..0000000 --- a/src/test/resources/test.log +++ /dev/null @@ -1 +0,0 @@ -{"recordType":"StorageUsageRecord","operationCount":1,"creationTime":1568579864273,"consumerId":"gCubeSocialFramework","resourceOwner":"gCubeSocialFramework","dataType":"STORAGE","providerURI":"data.d4science.org","resourceURI":"5d7ea11702cadc2c31b17af0","aggregated":true,"resourceScope":"/d4science.research-infrastructures.eu/D4Research/RAKIP_portal","dataVolume":2328,"scope":"/d4science.research-infrastructures.eu/D4Research/RAKIP_portal","operationType":"CREATE","startTime":1568579864272,"id":"999eb4ca-1f6c-43d1-879a-d91855e3a1c8","endTime":1568579864272,"operationResult":"SUCCESS"}